Total Pageviews

Wednesday 7 June 2017

彻底卸载系统自带的apache2,然后安装nginx

仅仅运行 apt-get remove apache2 -y是不够的。这样操作后,访问http://vps_ip,依旧显示apache2的默认页面。

再运行:
apt-get --purge remove apache2 -y
rm -rf /var/www
这样才彻底卸载了apache2

然后运行apt-get install nginx -y
这样安装的nginx webserver的根目录是/usr/share/nginx/html/
nginx的配置文件为/etc/nginx/sites-available/default 
但是在ubuntu下安装nginx后,其配置文件/etc/nginx/sites-available/default里的root的值为
/var/www/html,应该改为/usr/share/nginx/html
然后需重启nginx:
/etc/init.d/nginx restart

No comments:

Post a Comment