miller

1483 经验值

我在本地使用 vagrant 搭建 lnmp ,但是配置后,站点访问不了,提示403,具体配置如下:

vagrant:Vagrant 1.8.4

centos: CentOS Linux release 7.2.1511 (Core)

nginx: nginx/1.6.3

php: PHP 7.0.7 (cli) (built: May 31 2016 11:35:29) ( NTS )

使用 nginx -t

[vagrant@localhost conf.d]$ nginx -tnginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)2016/07/06 02:55:08 [warn] 4600#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5nginx: the configuration file /etc/nginx/nginx.conf syntax is ok2016/07/06 02:55:08 [emerg] 4600#0: open() "/run/nginx.pid" failed (13: Permission denied)nginx: configuration file /etc/nginx/nginx.conf test failed

/etc/nginx/conf.d/basic.conf:

server {
  listen        80;
  server_name   centos7.loc;
  root          /home/vagrant/www/default;
  index         index.php index.html;
}

站点文件:/home/vagrant/www/default/index.php

<?php phpinfo(); ?>

本地 host 文件:/etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 
192.168.33.10 centos7.loc

配置后使用 sudo systemctl reload nginx 重启 nginx,访问显示如下:

centos7.loc

QQ20160706-0@2x.png

192.168.33.10

QQ20160706-1@2x.png

这是什么情况?