一个阿里云apache服务器配置两个或多个域名forLinux
一个阿里云apache服务器配置两个或多个域名for Linux:
-
默认已经配置好了阿里云提供的一键web安装,可以参考:http://www.42iot.com/?id=8
-
修改/alidata/server/httpd/conf/vhosts下的文件phpwind.conf
打开phpwind.conf命令:vi phpwind.conf
在后面添加红色标记部分(以jiajiao2.kechengliu.com为例,目录为/alidata/www/jiajiao)
<DirectoryMatch "/alidata/www/phpwind/(attachment|html|data)">
<Files ~ ".php">
Order allow,deny
Deny from all
</Files>
</DirectoryMatch>
<VirtualHost *:80>
DocumentRoot /alidata/www/phpwind
ServerName localhost
ServerAlias localhost
<Directory "/alidata/www/phpwind">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ .php?
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ /simple/index.php?
</IfModule>
ErrorLog "/alidata/log/httpd/phpwind-error.log"
CustomLog "/alidata/log/httpd/phpwind.log" common
</VirtualHost>
<font color="#ff0000"><VirtualHost *:80>
DocumentRoot /alidata/www/jiajiao
ServerName jiajiao2.kechengliu.com
ServerAlias jiajiao2.kechengliu.com
<Directory "/alidata/www/jiajiao">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ .php?
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ /simple/index.php?
</IfModule>
ErrorLog "/alidata/log/httpd/jiajiao-error.log"
CustomLog "/alidata/log/httpd/jiajiao.log" common
</VirtualHost></font>
3.输入命令:/alidata/server/httpd/bin/apachectl restart 重启apache测试。
4.测试网站。请在浏览器中输入域名,测试设置。
域名1:www.kechengliu.com默认是localhost,访问的是/alidata/www/phpwind下的文件
域名2:jiajiao2.kechengliu.com访问的是/alidata/www/jiajiao下的文件
注:转载请注明出处https://bbs.aliyun.com/read/237396.html