• notice
  • Congratulations on the launch of the Sought Tech site

Wordpress configuration fixed link nginx access 404 problem solution

WordPress supports the use of permalinks, but in the ngnix environment, 404 appears after visiting the page,

In fact, there are official documents, and you need to write the configuration separately.

The sample code I configured here is as follows:

 

  1. server {  

  2.     listen 80;  

  3.     server_name www.chaichunyan.com;  

  4.   

  5.     access_log /var/log/nginx/access.log main;  

  6.   

  7. location / {  

  8.         root /www/data/xxx;  

  9.         index index.php index.html index.htm;  

  10.   

  11.         if (-f $request_filename/index.html){  

  12.                rewrite (.*) $1/index.html break;  

  13.         }  

  14.         if (-f $request_filename/index.php){  

  15.                rewrite (.*) $1/index.php;  

  16.          }  

  17.         if (!-f $request_filename){  

  18.                rewrite (.*) /index.php;  

  19.          }  

  20. }  

  21. rewrite /wp-admin$ $scheme://$host$uri/ permanent;  

  22.   

  23.     location ~ \.php$ {  

  24.         root /www/data/xxx;  

  25.         fastcgi_pass 127.0.0.1:9000;  

  26.         fastcgi_index index.php;  

  27.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  

  28.         include fastcgi_params;  

  29.     }  

  30. }  


Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

generic lipitor 10mg & lt;a href="https://lipiws.top/"& gt;order lipitor 40mg& lt;/a& gt; atorvastatin usa

Wlyxdm

2024-03-07

Leave a Reply

+