HTTPS配置伪静态

来源:互联网 发布:vscode 运行npm命令 编辑:程序博客网 时间:2024/06/08 23:15

因为要把一个网站项目导入到另一台服务器,在部署上去之后忽然想到要用的是443端口(https)进行访问,而且这个网站项目用到的是伪静态。以前想到配置80端口的伪静态的时候,一般就是直接修改apache的配置文件httpd.conf 把LoadModule rewrite_module modules/mod_rewrite.so 的注释‘#’去掉即可 但是这是80的办法,443的该怎么解决呢?
其实办法很简单 之前应该讲过443端口的配置文件是在/apache/conf/extra/httpd-ssl.conf里,我们找到这个文件进行编辑,这里拿我服务器上的配置文件举例

<VirtualHost _default_:443>#   General setup for the virtual hostProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:10000/yjdata/www/www/$1#ProxyPassMatch  ^/(.*\.php)$ fcgi://127.0.0.1:10000/usr/local/apache2/htdocs/$1DirectoryIndex index.html index.phpDocumentRoot "/yjdata/www/www/"#DocumentRoot "/usr/local/apache2/htdocs/"ServerName www.hyfwechat.cn:443ServerAdmin hsy@heyifu-pay.comErrorLog "/usr/local/apache2/logs/error_log"TransferLog "/usr/local/apache2/logs/access_log

这里的配置是不是跟httpd.conf里的很像

#<VirtualHost *:80>#    ServerAdmin webmaster@dummy-host.example.com#    DocumentRoot /www/docs/dummy-host.example.com#    ServerName dummy-host.example.com#    ErrorLog logs/dummy-host.example.com-error_log#    CustomLog logs/dummy-host.example.com-access_log common#</VirtualHost>

但是我们的重点不在这里,放这段代码块儿在这里只是为了提醒大家千万不能在这块儿(<VirtualHost _default_:443></VirtualHost>)添加伪静态配置 否则重启apache肯定会报错
既然这块儿不可以,我们就在它外面配置就ok了

<Directory />    Options FollowSymLinks    AllowOverride All    Order allow,deny    Allow from all</Directory>

把这块儿的代码复制到VirtualHost代码块儿之外就可以,然后重启apache https伪静态就配置完成了
小结:如果还不可以的话,请注意VirtualHost代码块儿里是否添加了

DirectoryIndex index.html index.php
原创粉丝点击