关于Apache2的几个修改
1、修改端口
vim /etc/apache2/ports.conf
修改Listen 3333
vim /etc/apache2/sites-enabled/000-default.conf
修改第一行<VirtualHost *:3333>
重启服务
2、修改默认路径
vim /etc/apache2/apache2.conf
往下翻页,添加
<Directory /home/user/web>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
vim /etc/apache2/sites-enabled/000-default.conf
更改 DocumentRoot /home/user/web
重启服务
3、修改默认路径到用户目录,并给予修改权限
mkdir /home/user/web
vim /etc/apache2/envvars
更改apache用户与组
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
修改为:
export APACHE_RUN_USER=user
export APACHE_RUN_GROUP=user
(与你系统的用户同名,避免Apache2 写入权限的问题)
重启服务

Leave a Reply

Your email address will not be published. Required fields are marked *