I'm running WordPress with nginx, but I got hooked on the fixed page display, so I have a question.
From nginx.conf (partial) in (1) below,
location/{
index index.php
try_files$uri$uri//index.php?q=$uri&$args;
location~*/wp-config.php{
deny all;
}
location~\.php${
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME/usr/share/nginx/html/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME/usr/share/nginx/wordpress/$fastcgi_script_name;
include/etc/nginx/fastcgi_params;
}
}
I have changed the setting to (2) below.
location/{
try_files$uri$uri/@wordpress;
}
location~\.php${
try_files$uri@wordpress;
fastcgi_index index.php;
fastcgi_split_path_info^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME/usr/share/nginx/wordpress$fastcgi_script_name;
include fastcgi_params;
}
location@wordpress{
fastcgi_index index.php;
fastcgi_split_path_info^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME/usr/share/nginx/wordpress/index.php;
include fastcgi_params;
}
However, the fixed page is not displayed as 404 in the setting of の, and the top page and dashboard are not displayed as 403 in the setting of の.
I'm at a loss because I don't know how to set up nginx.conf to display all the pages.
If anyone understands, please take care of me.
If you cannot find the specified file or folder, redirect it to index.php in the folder where wordpress is installed to display a fixed page for now.
I will write a sample configuration below, but I recommend that you read https://wpdocs.osdn.jp/Nginx.
Prerequisites: nginx.conf is installed in folder/wordpress by default and you can log in to wordpress, and the permlink setting is changed to numeric base
The easiest way to set it up in your environment is
location/{
index index.html index.php;
try_files$uri$uri//wordpress/index.php?$args;
}
try_files$uri$uri//wordpress/index.php?$args;
You only need to add one line to the route definition.
If it is displayed above, it may appear if you review the definition of の.
fastcgi_param SCRIPT_FILENAME/usr/share/nginx/wordpress/$fastcgi_script_name;
Is the document route path (/usr/share/nginx/wordpress/) specified in correct?
Include fastcgi_params; has fastcgi_param SCRIPT_FILENAME defined and SCRIPT_FILENAME may be overwritten, so why don't you move the include position to fastcgi_index index.php;?
© 2024 OneMinuteCode. All rights reserved.