Wordpress永久链接在Nginx 404错误

时间:2016-10-22 15:58:32

标签: 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_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;
        }
}

网站在域上正常运行,例如http://somedomain.com。但是当我尝试使用固定链接http://somedomain.com/post-about-sea打开一些帖子时,我收到404错误。我该如何解决?谢谢!

2 个答案:

答案 0 :(得分:7)

那个人应该工作。 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;
        }
}

答案 1 :(得分:0)

如果您将Elasticbeanstalk与Amazon Linux 2一起使用,则以下内容将为您工作: 在给定目录中创建文件:

enter image description here

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

grouped = df.groupby(["group","description","date"],as_index=False)["quantity"].sum()
grouped["pct_change"] = grouped.groupby("group",as_index=False)["quantity"].pct_change()+1
grouped["pct_change"].fillna(0,inplace=True)

grouped.groupby(["group","description","date"])[["quantity","pct_change"]].agg(lambda x: x)

                         quantity   pct_change
group description   date        
group_a desc_a  2019-01-01  1        0.0
                2019-02-01  2        2.0
                2019-03-01  3        1.5
group_b desc_b  2019-01-01  1        0.0
                2019-02-01  2        2.0
                2019-03-01  3        1.5
group_c desc_c  2019-01-01  1        0.0
                2019-02-01  1        1.0
                2019-03-01  3        3.0