저는 웹 사이트 및 Invision Power Boards의 루트로서 Wordpress를 사용하고 있습니다. 내가 IPB에 SEO 친화적 인 URL을 사용하려고 할 때 그러나 Nginx와가 - 다시 성공적으로 워드 프레스의 URL에서 "index.php에"를 제거한Nginx를 다시 작성하여 루트에서만 URL에서 index.php를 제거하십시오.
http://localhost -> Wordpress
http://localhost/forum -> IPB
는 nginx를 단순히 워드 프레스 '404 페이지로 돌아갑니다. http://www.devcu.com/forums/topic/262-furl-friendly-urls-with-ipb-and-nginx/
#This part is to be able to use IPB SEO
location /forum/ {
index index.php;
try_files $uri $uri/ /forum/index.php?$uri&$args;
rewrite^/index.php? last;
}
:
이#This removes "index.php" from Wordpress URLs
location/{
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
가 그럼 난 IPB의 SEO 친화적 인 URL을 사용할 수 있도록하기 위해 내의 nginx의 conf 파일을 수정하려면이 링크를 따르
내 구성이 같다 포럼에서 링크를 클릭하십시오 (for example: http://localhost/forum/index.php/forum/51-sport/)
nginx는 단순히 Wordpress 404 오류 페이지를 표시하는 (http://localhost/forum/forum/51-sport/)
으로 리디렉션됩니다.
정규식에 대한 지식이 거의 없으므로 도움을 얻을 수 있습니다.
수정 후 내 모든 conf 파일입니다.
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /home/user_name/public_html;
access_log /var/log/nginx/a/access.log;
error_log /var/log/nginx/a/error.log
server_name localhost;
server_tokens off;
location/{
try_files $uri $uri/ @wordpress;
}
location @wordpress {
fastcgi_pass php-fpm;
fastcgi_param SCRIPT_FILENAME /home/user_name/public_html$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME /index.php;
}
location /forum {
try_files $uri $uri/ try_files $uri $uri/ /forum/index.php?q=$uri;
}
location /forum/ {
try_files $uri $uri/ try_files $uri $uri/ /forum/index.php?q=$uri;
}
#location/{
#index index.php index.html index.htm;
#try_files $uri $uri/ /index.php?q=$uri&$args;
#}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \.php$ {
fastcgi_split_path_info ^(/)(/.*)$;
}
# Add trailing slash to */wp-admin and */forum requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001
#location ~ \.php$ {
# fastcgi_split_path_info ^(/)(/.*)$;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /home/user_name/public_html$fastcgi_script_name;
# fastcgi_param PATH_INFO $fastcgi_script_name;
# include /etc/nginx/fastcgi_params;
#REMOVE THIS
#fastcgi_read_timeout 60000;
#fastcgi_send_timeout 6000;
#}
}
마지막 게시물부터 IPB의 SEO 구성을 사용하여 URL에서 "index.php"를 제거 할 수있었습니다. 물론 결과에 영향을 미치지는 않습니다. 그러나 그것은 location /
가 무엇을 할 것인가를 결정하고 따라서 링크가 Wordpress permalink로 간주되고있는 것으로 보입니다.
은 편집 - 나도 지금의 nginx에 워드 프레스와 IPB를 사용하여 구성하고 있습니다
# Upstream to abstract backend connection(s) for php
upstream php {
# server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9001;
}
server {
## Your website name goes here.
server_name localhost;
## Your only path reference.
root /home/username/public_html;
## This should be in your http block and if it is, it's not needed here.
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location/{
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php;
}
location /forum {
try_files $uri $uri/ /forum/index.php;
rewrite^/forum/index.php? break;
}
location ~ ^/forum/index.php {
if ($args != "") {
rewrite^http://www.google.com/ permanent;
}
try_files $uri $uri/ /forum/index.php;
rewrite^/forum/index.php? last;
}
location /forum/admin/ {
try_files $uri $uri/ /forum/admin/index.php;
rewrite^/forum/admin/index.php? last;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include /etc/nginx/fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
근무 질문을하면 대답 섹션에 넣고 받아 들여야합니다. – Brenden