apache操作

1.修改网站根目录

1.1 mac上

sudo vim /etc/apache2/httpd.conf

DocumentRoot "/Users/yesiming/work/phpstorm/p1"

<Directory "/Users/yesiming/work/phpstorm/p1">


1.2 ubuntu上(apt-get安装不会出现httpd.conf文件

sudo vim /etc/apache2/apache.conf

sudo vim /etc/apache2/sites-available/000-default.conf

修改目录后要注意权限 (命令: chmod 644 index.html)

-rw-r----- 1 root root  21 Apr  9 15:01 index.html 

-rw-r--r-- 1 root root 12K Apr  9 13:21 index.html.bak


index.html 的权限会导致访问权限不足


必须改成 index.html.bak 的权限 (其它用户可读)


2.启动apache

sudo apachectl -k start


你可能感兴趣的:(apache)