Linux下Apache配置
- 在Apache配置目录下,找到httpd.conf文件,我的目录是在
/etc/httpd/conf
下 - 打开配置文件,在大概70行的位置上可以看到配置文件的注释:
- 这段注释的大概意思是我们可以通过添加
<VirtualHost></VirtualHost>
标签框来定义虚拟主机,同时会覆盖默认的配置 - 接下来就是自己配置端口了如下:
<VirtualHost *:80>
ServerName www.xxxxx.net
DocumentRoot "/xxx"
<Directory "/xxx/">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerName www.xxxxx.net:8080
DocumentRoot "/xx/xxx"
<Directory "/xx/xxx/">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>