Nginx 404中的Wordpress Permalinks错误

Nginx 404中的Wordpress Permalinks错误,wordpress,nginx,Wordpress,Nginx,有以下NGINX配置: server { listen 80; listen [::]:80; server_name <name>; client_max_body_size 32m; root /home/ulnda/www/wordpress; index index.html index.php; location / { try

有以下NGINX配置:

server {
        listen 80;
        listen [::]:80;

        server_name <name>;
        client_max_body_size 32m;
        root /home/ulnda/www/wordpress;
        index index.html index.php;

        location / {
                try_files $uri $uri/ =404;
        }
        location ~ \.php$ {
              include snippets/fastcgi-php.conf;
              include fastcgi_params;
              fastcgi_pass unix:/run/php/php7.0-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /home/ulnda/www/wordpress$fastcgi_script_name;
              fastcgi_param PHP_VALUE post_max_size=20M;
              fastcgi_param PHP_VALUE upload_max_filesize=20M;
        }
}
服务器{
听80;
听[:]:80;
服务器名称;
客户最大尺寸为32m;
root/home/ulnda/www/wordpress;
index.html index.php;
地点/{
try_files$uri$uri/=404;
}
位置~\.php${
包括snippets/fastcgi-php.conf;
包括fastcgi_参数;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_参数SCRIPT_FILENAME/home/ulnda/www/wordpress$fastcgi_SCRIPT_name;
fastcgi参数PHP值post最大值=20M;
fastcgi参数PHP值上传最大文件大小=20M;
}
}

例如,站点在域上正常工作。但当我试图用permalink打开一些帖子时,我得到了404错误。我怎样才能修好它?谢谢

这个应该有用。Nginx在您的配置中根本不应该返回404

server {
        listen 80;
        listen [::]:80;

        server_name <name>;
        client_max_body_size 32m;
        root /home/ulnda/www/wordpress;
        index index.html index.php;

        location / {
              try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php$ {                
              include snippets/fastcgi-php.conf;
              include fastcgi_params;
              fastcgi_pass unix:/run/php/php7.0-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /home/ulnda/www/wordpress$fastcgi_script_name;
              fastcgi_param PHP_VALUE post_max_size=20M;
              fastcgi_param PHP_VALUE upload_max_filesize=20M;
        }
}
服务器{
听80;
听[:]:80;
服务器名称;
客户最大尺寸为32m;
root/home/ulnda/www/wordpress;
index.html index.php;
地点/{
try_files$uri$uri//index.php?$args;
}
位置~\.php${
包括snippets/fastcgi-php.conf;
包括fastcgi_参数;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_参数SCRIPT_FILENAME/home/ulnda/www/wordpress$fastcgi_SCRIPT_name;
fastcgi参数PHP值post最大值=20M;
fastcgi参数PHP值上传最大文件大小=20M;
}
}

一个人应该工作。Nginx在您的配置中根本不应该返回404

server {
        listen 80;
        listen [::]:80;

        server_name <name>;
        client_max_body_size 32m;
        root /home/ulnda/www/wordpress;
        index index.html index.php;

        location / {
              try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php$ {                
              include snippets/fastcgi-php.conf;
              include fastcgi_params;
              fastcgi_pass unix:/run/php/php7.0-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /home/ulnda/www/wordpress$fastcgi_script_name;
              fastcgi_param PHP_VALUE post_max_size=20M;
              fastcgi_param PHP_VALUE upload_max_filesize=20M;
        }
}
服务器{
听80;
听[:]:80;
服务器名称;
客户最大尺寸为32m;
root/home/ulnda/www/wordpress;
index.html index.php;
地点/{
try_files$uri$uri//index.php?$args;
}
位置~\.php${
包括snippets/fastcgi-php.conf;
包括fastcgi_参数;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_参数SCRIPT_FILENAME/home/ulnda/www/wordpress$fastcgi_SCRIPT_name;
fastcgi参数PHP值post最大值=20M;
fastcgi参数PHP值上传最大文件大小=20M;
}
}

如果您在Amazon Linux 2上使用Elasticbeanstalk,那么以下内容将适用于您: 在给定目录下创建文件:

在此文件中添加以下代码:

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

如果您在Amazon Linux 2上使用Elasticbeanstalk,则以下内容适用于您: 在给定目录下创建文件:

在此文件中添加以下代码:

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