欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Nginx下Wordpress的永久鏈接實(shí)現(xiàn)(301,404等)

 更新時(shí)間:2012年09月28日 22:25:51   作者:  
經(jīng)過多番測(cè)試,終于在nginx下實(shí)現(xiàn)了rewrite的功能,WrodPress的永久鏈接終于生效了

其實(shí)也是很簡(jiǎn)單的方法,修改nginx.conf文件,加入以下內(nèi)容:

復(fù)制代碼 代碼如下:

location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}

重啟nginx就可以了。

以下是我的配置文件實(shí)例:

www# cat nginx.conf

user  www www;
worker_processes  10;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
worker_connections  1024;
}

http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] $request ‘
#                  ‘”$status” $body_bytes_sent “$http_referer” ‘
#                  ‘”$http_user_agent” “$http_x_forwarded_for”‘;

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
listen       80;
server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {
root   /usr/local/www/nginx;
index  index.php index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}

}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   /usr/local/www/nginx-dist;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root           html;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /usr/local/www/nginx$fastcgi_script_name;
include        fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

# HTTPS server
#
#server {
#    listen       443;
#    server_name  localhost;

#    ssl                  on;
#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;
#    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#    ssl_prefer_server_ciphers   on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}
}

相關(guān)文章

  • 詳解nginx 配置文件解讀

    詳解nginx 配置文件解讀

    這篇文章主要介紹了詳解nginx 配置文件解讀,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-07-07
  • nginx下支持PATH_INFO的方法實(shí)例詳解

    nginx下支持PATH_INFO的方法實(shí)例詳解

    這篇文章主要介紹了nginx下支持PATH_INFO的方法,結(jié)合實(shí)例形式詳細(xì)分析了nginx下使用PATH_INFO模式的具體方法與相關(guān)使用技巧,需要的朋友可以參考下
    2016-02-02
  • windows系統(tǒng)安裝配置nginx環(huán)境

    windows系統(tǒng)安裝配置nginx環(huán)境

    這篇文章介紹了windows系統(tǒng)安裝配置nginx環(huán)境的方法,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • NGINX配置目錄遍歷漏洞的解決

    NGINX配置目錄遍歷漏洞的解決

    目錄遍歷是一種安全漏洞,通常會(huì)影響Nginx服務(wù)器上的Web應(yīng)用程序,本文就來介紹一下NGINX配置目錄遍歷漏洞的解決,感興趣的可以了解一下
    2023-10-10
  • Nginx解決403 forbidden的完整步驟

    Nginx解決403 forbidden的完整步驟

    這篇文章主要給大家介紹了關(guān)于Nginx解決403 forbidden的完整步驟,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-09-09
  • Nginx從搭建到配置支持HTTPS的方法

    Nginx從搭建到配置支持HTTPS的方法

    這篇文章主要介紹了Nginx從搭建到配置支持HTTPS的方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-07-07
  • Nginx+Tomcat+Https 服務(wù)器負(fù)載均衡配置實(shí)踐方案詳解

    Nginx+Tomcat+Https 服務(wù)器負(fù)載均衡配置實(shí)踐方案詳解

    這篇文章主要介紹了Nginx+Tomcat+Https 服務(wù)器負(fù)載均衡配置實(shí)踐方案的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-09-09
  • 基于nginx實(shí)現(xiàn)上游服務(wù)器動(dòng)態(tài)自動(dòng)上下線無需reload的實(shí)現(xiàn)方法

    基于nginx實(shí)現(xiàn)上游服務(wù)器動(dòng)態(tài)自動(dòng)上下線無需reload的實(shí)現(xiàn)方法

    這篇文章主要介紹了基于nginx實(shí)現(xiàn)上游服務(wù)器動(dòng)態(tài)自動(dòng)上下線無需reload,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-02-02
  • nginx日常維護(hù)常用命令

    nginx日常維護(hù)常用命令

    這篇文章主要介紹了nginx日常維護(hù)如nginx啟動(dòng)、重啟、關(guān)閉等常用命令,需要的朋友可以參考下
    2014-03-03
  • nginx 限速之limit_conn的使用

    nginx 限速之limit_conn的使用

    通過nginx我們有三種限速方式分別是: 限制請(qǐng)求數(shù)(request),限制連接數(shù)(connection),限制響應(yīng)速度(rate),本文就來介紹一下nginx 限速之limit_conn的使用,ngx_http_limit_conn_module 模塊主要是用于根據(jù)特定的key來限制連接的數(shù)量,感興趣的可以了解一下
    2023-10-10

最新評(píng)論