本人昨天在阿里云租了一个服务器,选择的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错误。
这是为什么?
求解!!多谢!!
错误日志如下:
ringa_lee2017-04-22 08:57:43
It turns outroot
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.
怪我咯2017-04-22 08:57:43
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
huangyanxiong@huangyanxiong-Aspire-E1-471G:~/language/php/laravel$ id
uid=1000(huangyanxiong) gid=1000(huangyanxiong) 组=1000(huangyanxiong),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare)
huangyanxiong@huangyanxiong-Aspire-E1-471G:~/language/php/laravel$ ps aux |grep nginx
root 1292 0.0 0.0 85880 2880 ? Ss 13:01 0:00 nginx: master process /usr/sbin/nginx
huangya+ 1298 0.0 0.0 86284 3512 ? S 13:01 0:00 nginx: worker process
huangya+ 1299 0.0 0.0 86284 3512 ? S 13:01 0:00 nginx: worker process
huangya+ 1300 0.0 0.0 86284 3512 ? S 13:01 0:00 nginx: worker process
huangya+ 1301 0.0 0.0 86284 3512 ? S 13:01 0:00 nginx: worker process
huangya+ 4778 0.0 0.0 15964 2200 pts/2 S+ 13:44 0:00 grep --color=auto nginx
huangyanxiong@huangyanxiong-Aspire-E1-471G:~/language/php/laravel$ ps aux |grep php-fpm
root 1146 0.0 0.4 381444 29028 ? Ss 13:01 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
huangya+ 1224 0.0 0.1 381444 8704 ? S 13:01 0:00 php-fpm: pool www
huangya+ 1225 0.0 0.1 381444 8704 ? S 13:01 0:00 php-fpm: pool www
huangya+ 4780 0.0 0.0 15964 2228 pts/2 S+ 13:44 0:00 grep --color=auto php-fpm
That is, the root directory of the website, nginx and php-fpm all use the same user