qq_35044382
我就是奔着问问题来的
2017-05-30 14:25

能在Apache下运行网站,但不能在nginx的根目录下运行,为什么?

  • apache
  • nginx
  • linux

提示 403 Forbidden Nginx版本号错误

两个服务可以同时启动,防火墙也允许了对应的端口

错误日志/var/log/nginx/access.log

192.168.128.131 - - [30/May/2017:03:26:58 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:03:26:59 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:03:27:00 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:03:27:03 +0800] "GET /mysite/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:03:27:09 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:37:28 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:37:29 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:37:30 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:47:04 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:47:05 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [30/May/2017:13:47:06 +0800] "GET /mysite/lyadmin/ HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:04:13 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:04:13 +0800] "GET /favicon.ico HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:07:52 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:07:53 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:07:54 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:10:45 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:10:47 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:10:47 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:10:52 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:11:04 +0800] "GET /lyadmin HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:11:23 +0800] "GET /lyadmin/index.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:15:10 +0800] "GET /lyadmin/index.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:15:16 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:23:06 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:23:07 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:23:07 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:23:08 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:23:09 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:24:39 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:24:40 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"
192.168.128.131 - - [31/May/2017:16:24:45 +0800] "GET /info.php HTTP/1.1" 404 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" "-"

/etc/nginx/conf.d/default配置:
这个配置是零云框架默认的,没改过
server {
listen 80;
root /usr/share/nginx/html/mysite;
index index.html index.htm index.php;
server_name localhost;

location / {
    # URL重写支持
    try_files $uri $uri/ /index.php?s=$uri&$args;
}

# 开启PHP支持
location ~ \.php {
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param PATH_INFO $fastcgi_path_info;

    # 环境变量
    fastcgi_param CT_DEV_MODE 'true';

    # 加载Nginx默认"服务器环境变量"配置
    include fastcgi_params;
}

}

链接

http://blog.csdn.net/han_cui/article/details/54892400?locationNum=14&fps=1

根据这个链接,加的代码却报错
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/mysite/$fastcgi_script_name;

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐