我有一个Centosnetworking服务器build立了2个网站。 最初它只有一个网站,虚拟主机configuration被添加到httpd.conf文件的末尾。 不是最好的做法,但我知道它工作正常,看起来如下。 <VirtualHost *:80> ServerName www.example.com ServerAlias example.com #ServerAdmin [email protected] DocumentRoot /var/www/html/example/ ErrorLog /var/log/httpd/example_error.log CustomLog /var/log/httpd/example_access.log combined #loglevel warn <Directory /> #Options Indexes FollowSymLinks #AllowOverride None #Require all granted Options Indexes FollowSymLinks MultiViews Allowoverride All Order allow,deny allow from all </Directory> 添加了第二个开发网站,它是第一个开发网站的副本,在httpd.conf文件中的第一个虚拟主机的下方创build了虚拟主机,如下所示: <VirtualHost *:80> ServerName dev.example.com ServerAlias dev.example.com DocumentRoot /var/www/dev.example.com/html #ErrorLog /var/log/httpd/dev.example.com/error.log #CustomLog /var/log/httpd/dev.example.com/requests.log […]
我遇到了Apache的问题,不想读取我的重写指令,并根据这些指令重写我的URL。 我有条件和规则直接写入我的Apache httpd.conf文件中: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} Round_2 RewriteRule ^Round_2/(.*)$ /newBuyer/desktop/$1 [R=301,L] RewriteCond %{REQUEST_URI} itemList RewriteRule ^/?(.*)/itemList/(.*)$ /newBuyer/$1/search/$2 [R=301,L] RewriteCond %{REQUEST_URI} eventDetail RewriteRule ^/?(.*)/eventDetail/(.*)$ /newBuyer/$1/event/$2 [R=301,L] </IfModule> 我已经重新加载Apache使用: $ apachectl -k graceful 刷新浏览器caching,redirect不起作用。 我能够使它在我的本地Windows Apache实例上工作,但不能在我的Apache的Cent7实例上工作。 我已经确认重写mod已经加载。
我想要以下redirect发生: http://www.example.org – > https://example.org [working] https://www.example.org – > https://example.org [不工作] 正如您在使用“https”时可以看到的那样,它不会redirect到https://example.org,而只是停留在https://www.example.org 我的www.conf(www.example.org): <VirtualHost *:80> ServerName www.example.org Redirect / https://example.org ServerAdmin webmaster@localhost DocumentRoot /srv/www ErrorLog ${APACHE_LOG_DIR}/www_error.log CustomLog ${APACHE_LOG_DIR}/www_access.log combined </VirtualHost> <VirtualHost *:443> ServerName www.example.org Redirect / https://example.org ServerAdmin webmaster@localhost DocumentRoot /srv/www ErrorLog ${APACHE_LOG_DIR}/www_ssl_error.log CustomLog ${APACHE_LOG_DIR}/www_ssl_access.log combined Include /etc/letsencrypt/certbot.conf </VirtualHost> 我的main.conf(例如.org): <VirtualHost *:80> ServerName example.org Redirect […]
我有多个域被设置为redirect(301)到我的主域。 不过,我知道这些领域中的一些在search引擎优化方面几乎没有任何价值,我想摆脱它们。 但我的一个担心是,在这些领域下可能存在反向链接。 我检查了谷歌分析,并没有出现这些域名,但我决定确认他们会注册,如果他们使用。 不幸的是,在testing中,我的Apache 301redirect似乎没有保留引用的URL。 我知道这在很大程度上取决于客户,但似乎共识是大多数时候这是保留。 在现代浏览器中是否有任何设置指示他们在redirect时删除引用链接? 我在Firefox,Chrome和IE中遇到这种情况。 有什么我可以做的服务器端,可能会影响客户端,以保持引荐? 如果这是一个死胡同,还有什么其他方法来检查这些别名域的反向链接或用法? 这是我的redirect: ## Redirect non www to www RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://www.example.com$1 [R=301,L]
有没有人知道只有在Apache HTTP 2.4.6中的初始创build响应(通过mod_jk进行代理响应)时才会设置HTTP响应头? 我正在寻找一种方法来设置X-FRAME-OPTIONS标题,但只有当源页面没有明确地设置。 我知道Apache HTTP 2.4具有来自mod_header的setifempty动作,但直到Apache HTTP 2.4.7才存在。 我不想更改apache版本,因为那样会使我脱离发行版(CentOS 7)的更新path。
我正在尝试在代理发生之前重新编写URL的一部分( https://myfirstdomain.com/lool/https:/alf.mydomain.com/service/wopi/files/uuid?query_params ),我有这个我的默认SSL vhost中的相关部分: <IfModule mod_rewrite.c> RewriteEngine On LogLevel debug rewrite:trace3 RewriteRule ^lool/https:/alf.mydomain.com\/(.*) lool/https://alf.mydomain.com/$1 [QSA,NE] </IfModule> ProxyPass / https://localhost:2323/ ProxyPassReverse / https://localhost:2323/ 我在重写日志中看到这个: applying pattern '^lool/https:/alf.mydomain.com' to uri '/lool/https:/alf.mydomain.com/service/wopi/files/uuid 但在收到这个服务,我看到的URL没有被重写。 对于我在做什么错误的任何线索将感激不尽。 我本质上是试图添加额外/已被我没有访问的基础设施中的代理服务器删除。 编辑:在后端WOPI服务的日志中,它看到请求URL未修改: Request from 127.0.0.1:42035: GET /lool/https:/alf.mydomain.com/service/wopi/files/uuid
这是我遇到的一个奇怪的问题。 我正在使用mod_rewrite重写URL后调用的框架。 如果URI中的字符是重音字符,就像在拉丁字母表中那样,请求永远不会发送到我的框架中,而是服务器出错,出现在404上。我使用Windows机器,所以不知道这是否有一些去做或不做。 只要URI中没有重音字符,就可以毫无问题地将请求发送给框架。 有人可以告诉我这里发生了什么,以及如何解决这个问题? 编辑:这里是我的access.log 2行。 第一行显示了由Apache编码的重音Å ,并且没有通过。 当我将URI中的Å更改为英文“A”时,一切正常。 127.0.0.1 – – [20/Oct/2017:13:50:50 -0400] "GET /actor/%C3%85ker HTTP/1.1" 404 222 127.0.0.1 – – [20/Oct/2017:13:54:48 -0400] "GET /actor/Aker HTTP/1.1" 200 5701 编辑:这些是.htaccess文件中的行 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?request=$1 [L,QSA] 这是一个由两个人组成的debugging日志的一部分,显示其中一个mod_rewrite不会将请求转发到我的框架,另一个是。 这是失败的: [Fri Oct 20 17:52:48.119655 2017] [rewrite:trace3] [pid 1620:tid 792] mod_rewrite.c(480): [client 127.0.0.1:52846] […]
我一步一步在我的VPS上安装apache和php 安装Apache 安装PHP7 安装和configuration我的Apache和PHP后,我看到我的PHP代码在页面上。 喜欢这个: <?php defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run();
这个问题 我想了解如何实现从http到https的redirect,使用Apache2和Certbot的authentication。 细节 在运行Ubuntu 16.04的全新服务器上,我安装了一个“完美服务器”设置 (ISPConfig,Postfix,Dovecot和家族),以便运行一个小型的电子邮件服务器。 我也使用Certbot来安装SSL证书。 在使用Certbot之前,我手动将ServerName my.domain.com添加到我在/etc/apache2/sites-available/目录中find的四个文件中。 00 default.conf apps.vhost 默认的ssl.conf ispconfig.vhost …还有这个文件: /etc/apache2/apache2.conf中 我的理解是,这给了Certbot有关服务器上存在的域名的信息,并确保遇到的挑战。 (也许这是矫枉过正的?也许只编辑`apache2.conf? 然后我跑了: certbot –apache -d my.domain.com 在安装过程中,我select了redirect选项: Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. ——————————————————————————- 1: No redirect – Make no further changes to the webserver configuration. 2: Redirect – Make […]
我正在努力解决上述在SEO中出现的问题。 以下解决scheme是build议的解决scheme: <IfModule mod_headers.c> # Unset Server Signature header ServerSignature Off # Unset Server Technology header Header unset X-Powered-By </IfModule> <IfModule mod_headers.c> # Set XSS Protection header Header set X-XSS-Protection "1; mode=block" </IfModule> 我已经把这个放在“附加的Apache指令”中,但是无济于事。 我的服务器托pipe公司似乎无法提供帮助。 我没有得到任何语法错误。 这似乎并没有工作。 我在CentOS Linux 7.4.1708(Core)上运行Plesk 12.5.30 Update#71。 Apache和nginx。 任何帮助,将不胜感激,因为我现在正撕裂我的头发!