本人昨天在阿里云租了一个服务器,选择的ubuntu server服务器。
后来安装了nginx,访问服务器IP,能出来“Welcome to nginx!”的字样,说明nginx安装启动没有问题。
后来我自定义配置了nginx.conf文件,主要是想改网站根目录。修改的nginx.conf如下:
我可以保证这个目录是没有问题的,如下图:
分割线----------------------------------------------------
但是,结果是,访问IP,出现了404错误!
无论是访问 http://120.25.238.160/index.html 还是 http://120.25.238.160/ 都是404错误。
这是为什么?
求解!!多谢!!
错误日志如下:
It turns out
root
points to the default directory, refer to http://stackoverflow.com/questions/10674867/nginx-default-public-www-l...May point to
/usr/local/nginx/html
;Now there is a 404 error, proving the
nginx
还是能启动起来的,你可以确认一下/home/wfp/chatyou.net/website
目录下有没有index.html
file.There is a permission problem when you do this. nginx is the www-data user, and the root directory of your website is owned by wfp. You also need to change a permission setting,
I once had a problem like this and I did this and thought it would be safer
That is, the root directory of the website, nginx and php-fpm all use the same user