ztboy 发表于 2017-7-8 09:44:05

nginx伪静态规则应该放在那里?

rewrite ^/(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php last;
rewrite ^/(.*)/(admin|cache|editor|file|include|lang|module|skin|template)/(.*)\.php(.*)$ /404.php last;
rewrite ^/(.*)-htm-(.*)$ /$1.php?$2 last;
rewrite ^/(.*)/show-(+)([\-])?(+)?\.html$ /$1/show.php?itemid=$2&page=$4 last;
rewrite ^/(.*)/list-(+)([\-])?(+)?\.html$ /$1/list.php?catid=$2&page=$4 last;
rewrite ^/(.*)/show/(+)/(+)?([/])?$ /$1/show.php?itemid=$2&page=$3 last;
rewrite ^/(.*)/list/(+)/(+)?([/])?$ /$1/list.php?catid=$2&page=$3 last;
rewrite ^/(.*)/(+)-c(+)-(+)\.html$ /$1/list.php?catid=$3&page=$4 last;
rewrite ^/(.*)/(+)-(+)-(+)-(+)\.html$ /$1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5 last;
rewrite ^(.*)/(+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3 last;
rewrite ^/(com)/(+)/(+)/(.*)\.html$ /index.php?homepage=$2&file=$3&rewrite=$4 last;
rewrite ^/(com)/(+)/(+)([/])?$ /index.php?homepage=$2&file=$3 last;
rewrite ^/(com)/(+)([/])?$ /index.php?homepage=$2 last;
         
         
      

应该放在那里呢?


#power by www.phpStudy.net
#usernobody;
worker_processes1;

#error_loglogs/error.log;
#error_loglogs/error.lognotice;
#error_loglogs/error.loginfo;

#pid      logs/nginx.pid;


events {
    worker_connections1024;
}


http {
    include       mime.types;
    default_typeapplication/octet-stream;

    #log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_loglogs/access.logmain;

    sendfile      on;
    #tcp_nopush   on;

    #keepalive_timeout0;
    keepalive_timeout65;
    #tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;










#gzipon;
gzip on;
gzip_min_length1k;
gzip_buffers   4 32k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css application/xml;
gzip_vary on;
gzip_disable "MSIE .";

server_names_hash_bucket_size 128;
client_max_body_size   100m;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;

    server {
   
   

   
   
   
   
   
      listen       80;
      server_namelocalhost;

      #charset koi8-r;

      #access_loglogs/host.access.logmain;
            root   "D:/wwwww/wwwchinafilterorg/company";
      location / {
            indexindex.html index.htm index.php l.php;
            
            
            

            
            
            
            
            
            
            
            
         autoindexoff;
         
   
         
         
         
         
         
      }
      
      
      

      
      
      
      
      

      #error_page404            /404.html;

      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504/50x.html;
      location = /50x.html {
            root   "D:/wwwww/wwwchinafilterorg/company";
      }

      # 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(.*)${
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_indexindex.php;
            fastcgi_split_path_info^((?U).+\.php)(/?.+)$;
            fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
            fastcgi_paramPATH_INFO$fastcgi_path_info;
            fastcgi_paramPATH_TRANSLATED$document_root$fastcgi_path_info;
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            include      fastcgi_params;
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
      }

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


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

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


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_namelocalhost;

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

    #    ssl_session_timeout5m;

    #    ssl_protocolsSSLv2 SSLv3 TLSv1;
    #    ssl_ciphersHIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

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

include vhosts.conf;


}

joy 发表于 2017-7-10 08:30:07


对应站点配置文件里面的location / {里面

zhao90 发表于 2017-7-10 15:06:25


你站点的绑定目录在哪块

枪口的雨 发表于 2017-7-11 18:01:57


站点配置文件里

joy 发表于 2017-7-19 08:57:26


你的伪静态设置好了吗

龙在天涯 发表于 2017-7-19 17:02:47


放在index.htm的下面
页: [1]
查看完整版本: nginx伪静态规则应该放在那里?