Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Nginx:Can';不要打开网站上的任何链接。只显示网页_Php_Nginx_Webserver - Fatal编程技术网

Php Nginx:Can';不要打开网站上的任何链接。只显示网页

Php Nginx:Can';不要打开网站上的任何链接。只显示网页,php,nginx,webserver,Php,Nginx,Webserver,我在Nginx上运行了一个网站。我有一个问题,因为主页加载正常,但我不能通过主页访问任何其他链接-什么都没有发生 server { server_name example.com www.example.com; root /usr/share/nginx/example.com; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.p

我在Nginx上运行了一个网站。我有一个问题,因为主页加载正常,但我不能通过主页访问任何其他链接-什么都没有发生

    server {
  server_name example.com www.example.com;
  root /usr/share/nginx/example.com;
  index index.php index.html index.htm;

 location / {
                try_files $uri $uri/ /index.php$args;
        }

        location ~ \.php$ {
               fastcgi_pass   127.0.0.1:9000;
               fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/example.com$fastcgi_script_name;
               include        fastcgi_params;
            }

        location ~ /\.ht {
                deny all;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example/com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

Nginx不显示该问题的日志。

删除
/etc/Nginx/sites enabled/*
/etc/Nginx/sites enabled/*
中的所有默认Nginx文件,如果此配置处于活动状态,您可能会遇到问题

验证它在
/etc/nginx/nginx.conf
上是否有以下行:

include /etc/nginx/conf.d/*.conf; 
创建一个新文件
/etc/nginx/conf.d/example.com.conf
,然后尝试:

server {
    listen 80;

    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
}

server {
    listen 443 ssl;
    server_name example.com www.example.com;
    root /usr/share/nginx/example.com;

    access_log /var/log/nginx/ssl_exemple.com.log;
    error_log /var/log/nginx/error_ssl_exemple.com.log;

    index index.html index.htm index.php;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example/com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    # Not found this on disk?
    if (!-e $request_filename) {
        rewrite ^/(.+)$ /index.php?url=$1 last;
        break;
    }

    location / {
        index index.php;
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    # Pass the PHP scripts to FastCGI server
    # listening on 127.0.0.1:9000
    location ~ \.php$ {
        # fastcgi_pass   unix:/tmp/php-fastcgi.sock;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_intercept_errors on; # to support 404s for PHP files not found
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_read_timeout 1800;
        include fastcgi_params;
    }

    # Static files.
    # Set expire headers, Turn off access log
    location ~* \favicon.ico$ {
        access_log off;
        expires 1d;
        add_header Cache-Control public;
    }

    location ~ ^/(img|cjs|ccss)/ {
        access_log off;
        expires 7d;
        add_header Cache-Control public;
    }

    # Deny access to .htaccess files,
    # git & svn repositories, etc
    location ~ /(\.ht|\.git|\.svn) {
        deny  all;
    }
}

当我输入链接时,网站slug会发生变化,但不会显示任何内容