Apache:虚拟主机
在/etc/httpd/conf.d中新建一个conf文件
<VirtualHost *:80>
ServerAdmin dr@riguz.com
DocumentRoot "/home/webapp/chanzhieps/www"
ServerName dr.riguz.com
ServerAlias www.dr.riguz.com
ErrorLog "logs/chanzhi.log"
CustomLog "logs/chanzhi.log" common
<Directory "/home/webapp/chanzhieps/www">
Require all granted
</Directory>
</VirtualHost>
如果是wiki,可以再加一个配置文件
<VirtualHost *:80>
ServerAdmin dr@riguz.com
DocumentRoot "/home/webapp/wiki"
ServerName wiki.riguz.com
ServerAlias www.wiki.riguz.com
ErrorLog "logs/wiki.log"
CustomLog "logs/wiki.log" common
<Directory "/home/webapp/wiki">
Require all granted
AllowOverride all
</Directory>
</VirtualHost>
其中AllowOverride all配置允许使用.htaccess进行域名重写。如果要定向http到https,可以:
<VirtualHost *:80>
...
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
RewriteCond %{HTTPS} off
...
</VirtualHost>