Ubuntu下Apache2配置信息细节
文件目录
端口修改在/etc/apache2/ports.conf文件中
默认的配置文件目录在/etc/apache2/apache2.conf 文件中
修改完成后执行systemctl reload apache2
apache2的默认web目录:/var/www/html
设置默认主页的配置文件/etc/apache2/mods-enabled/dir.conf
关键命令
systemctl restart apache2
systemctl status apache2
systemctl start apache2
systemctl enable apache2
/etc/init.d/apache2 [ start | stop | restart | status ]
service apache2 [ start | stop | restart | status ]
为了修改它的监听端口\主机端口, next 2 files to change:
sudo vim /etc/apache2/ports.conf
sudo vim sites-enabled/000-default.conf
systemctl restart apache2
配置多域名、端口映射:
Listen 80
Listen 8080
<VirtualHost *:80>
DocumentRoot /var/www/html/项目1
ServerName http://www.域名1.com
</Virtualhost>
<Directory "/var/www/html/项目1">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/html/项目2
ServerName http://www.域名2.com
</Virtualhost>
<Directory "/var/www/html/项目2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost Ip:8080>
DocumentRoot /var/www/html/项目3
ServerName Ip:8080
</VirtualHost>
<Directory "/var/www/html/项目3">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>