0

我在 nginx 上有这个网站,它是一个图像网站的 php 脚本。

问题是,每当我单击主页上的链接时,它都会给我一个 404。我可以访问主页并显示最后的图像,我可以访问和使用管理面板,因此脚本或它的安装不是问题。

我相信问题出在我的 nginx.conf 文件上,但这是我第一次使用它,我找不到问题所在。我很确定这在 http 部分很容易。

任何人都可以看到问题是什么?

我附上 nginx.conf。

user www-data;
worker_processes 5;
pid /var/run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
    # server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

  index index.php;

##Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
 }

我为相关站点添加了启用站点和站点可用的文件。

站点启用文件

server {
      listen *:80;


    server_name MYSITE.com ;

    root   /var/www/MYSITE.com/web;



    index index.php;


    location ~ \.shtml$ {
        ssi on;
    }


    error_log /var/log/ispconfig/httpd/MYSITE.com/error.log;
    access_log /var/log/ispconfig/httpd/MYSITE.com/access.log combined;

    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location /stats {

        index index.html index.php;
        auth_basic "Members Only";
        auth_basic_user_file /var/www/clients/client0/web1/web/stats/.htpasswd_stats;
    }

    location ^~ /awstats-icon {
        alias /usr/share/awstats/icon;
    }

    location ~ \.php$ {
        try_files /446853f6175b4ee703d1115b71d6c0c9.htm @php;
    }

    location @php {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
    }

    location /cgi-bin/ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        root /var/www/clients/client0/web1;
        gzip off;
        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
        fastcgi_index index.cgi;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
    }






}

网站可用文件

server {
    listen *:80;


    server_name MYSITE.com ;

    root   /var/www/MYSITE.com/web;



    index index.php;


    location ~ \.shtml$ {
        ssi on;
    }


    error_log /var/log/ispconfig/httpd/MYSITE.com/error.log;
    access_log /var/log/ispconfig/httpd/MYSITE.com/access.log combined;

    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location /stats {

        index index.html index.php;
        auth_basic "Members Only";
        auth_basic_user_file /var/www/clients/client0/web1/web/stats/.htpasswd_stats;
    }

    location ^~ /awstats-icon {
        alias /usr/share/awstats/icon;
    }

    location ~ \.php$ {
        try_files /446853f6175b4ee703d1115b71d6c0c9.htm @php;
    }

    location @php {

        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
    }

    location /cgi-bin/ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        root /var/www/clients/client0/web1;
        gzip off;
        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
        fastcgi_index index.cgi;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
    }






}

我将 /var/log/ispconfig/httpd/MYSITE.com/error.log 的最后几行添加到我的帖子中。(编辑域很痛苦,所以我就把它留在那里,稍后再编辑问题)

2013/08/29 03:20:28 [error] 30672#0: *513 open() "/var/www/cosplayde.com/web/asdasd" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /asdasd HTTP/1.1", host: "cosplayde.com"
2013/08/29 03:20:29 [error] 30672#0: *513 open() "/var/www/cosplayde.com/web/hebi" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /hebi HTTP/1.1", host: "cosplayde.com"
2013/08/29 03:20:42 [error] 30672#0: *514 open() "/var/www/cosplayde.com/web/asdsa" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /asdsa HTTP/1.1", host: "cosplayde.com"
2013/08/29 03:21:43 [error] 30672#0: *515 open() "/var/www/cosplayde.com/web/casper" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /casper HTTP/1.1", host: "cosplayde.com"
2013/08/29 05:26:47 [error] 30672#0: *544 open() "/var/www/cosplayde.com/web/apple-touch-icon.png" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /apple-touch-icon.png HTTP/1.1", host: "cosplayde.com"
2013/08/29 05:27:16 [error] 30672#0: *545 open() "/var/www/cosplayde.com/web/apple-touch-icon-precomposed.png" failed (2: No such file or directory), client: 66.249.75.229, server: cosplayde.com, request: "GET /apple-touch-icon-precomposed.png HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:43:52 [error] 30670#0: *688 open() "/var/www/cosplayde.com/web/3" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /3 HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:44:20 [error] 30670#0: *689 open() "/var/www/cosplayde.com/web/2" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /2 HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:44:55 [error] 30670#0: *690 open() "/var/www/cosplayde.com/web/5" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /5 HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:45:29 [error] 30670#0: *692 open() "/var/www/cosplayde.com/web/rss" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /rss HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:46:04 [error] 30670#0: *693 open() "/var/www/cosplayde.com/web/hebi" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /hebi HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:46:38 [error] 30670#0: *694 open() "/var/www/cosplayde.com/web/asdsa" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /asdsa HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:47:12 [error] 30670#0: *695 open() "/var/www/cosplayde.com/web/dolina" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /dolina HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:47:47 [error] 30670#0: *696 open() "/var/www/cosplayde.com/web/touhou" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /touhou HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:48:22 [error] 30670#0: *697 open() "/var/www/cosplayde.com/web/kyuutsui" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /kyuutsui HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:48:58 [error] 30670#0: *698 open() "/var/www/cosplayde.com/web/cosplay-sexy" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /cosplay-sexy HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:49:34 [error] 30670#0: *699 open() "/var/www/cosplayde.com/web/submit_images" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /submit_images HTTP/1.1", host: "cosplayde.com"
2013/08/29 16:50:16 [error] 30670#0: *701 open() "/var/www/cosplayde.com/web/category/default" failed (2: No such file or directory), client: 66.249.72.229, server: cosplayde.com, request: "GET /category/default HTTP/1.1", host: "cosplayde.com"
2013/08/30 05:38:23 [error] 30669#0: *916 open() "/var/www/cosplayde.com/web/category/default" failed (2: No such file or directory), client: 120.151.131.182, server: cosplayde.com, request: "GET /category/default HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
2013/08/30 05:39:33 [error] 30669#0: *916 open() "/var/www/cosplayde.com/web/rss" failed (2: No such file or directory), client: 120.151.131.182, server: cosplayde.com, request: "GET /rss HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
2013/08/30 06:05:32 [error] 30669#0: *940 open() "/var/www/cosplayde.com/web/5" failed (2: No such file or directory), client: 200.126.222.14, server: cosplayde.com, request: "GET /5 HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
2013/08/30 06:17:24 [error] 10945#0: *1 open() "/var/www/cosplayde.com/web/5" failed (2: No such file or directory), client: 190.193.156.31, server: cosplayde.com, request: "GET /5 HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
2013/08/30 06:21:57 [error] 11863#0: *47 open() "/var/www/cosplayde.com/web/5" failed (2: No such file or directory), client: 200.126.222.14, server: cosplayde.com, request: "GET /5 HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
2013/08/30 06:22:10 [error] 11863#0: *47 open() "/var/www/cosplayde.com/web/kyuutsui" failed (2: No such file or directory), client: 200.126.222.14, server: cosplayde.com, request: "GET /kyuutsui HTTP/1.1", host: "cosplayde.com", referrer: "http://cosplayde.com/"
4

1 回答 1

0

您的网站是 wordpress 网站吗?了解您正在运行的 php 应用程序将有助于人们为您提供更准确的反馈。

仅根据您的站点配置和描述,

  1. 删除try_files $uri =404;位置@php下面的行
  2. 在之前添加以下行location ~ \.php$

    location / {
       try_files $uri =404;
    }    
    

高温高压

于 2013-08-30T03:52:06.380 回答