美文网首页
ubuntu配置apache

ubuntu配置apache

作者: 刘利华 | 来源:发表于2017-04-24 16:00 被阅读0次

1 修改host

添加你的ip和域名
sudo gedit /etc/hosts

2 添加你网址的文件夹

在/var/www/下添加

3 在/etc/apache2/sites-available下添加你的virtualhost配置

sites-available是你服务器所有网址的配置,可能包含不可用的.
sites-enabled 则是可用的网址,里面一些快捷方式,指向sites-available里的.conf文件.
先sudo cp 000-default.conf example.conf
再sudo ln -s example.conf ../sites-enabled/example.conf (创建快捷方式到sites-enabled)

4 修改/etc/apache2/apache2.conf

添加你网址的文件夹
<Directory /www/example>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

5 重启apche

sudo service apache2 restart

自己遇到的两个问题:
1 500错误,原因是里;laravel的storage文件夹需要777权限
2 查看apache的错误日志 /var/log/apache2/error.log
3 除了'/'可以访问,其他都是404.
需要打开rewrite,

sudo a2enmod rewrite
service apache2 restart

相关文章

网友评论

      本文标题:ubuntu配置apache

      本文链接:https://www.haomeiwen.com/subject/uvzbattx.html