destoon采集论坛

 找回密码
 立即注册
查看: 720|回复: 5

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

[复制链接]

158

主题

68

回帖

1026

积分

金牌会员

Rank: 6Rank: 6

积分
1026
发表于 2017-7-8 09:44:05 | 显示全部楼层 |阅读模式
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-([0-9]+)([\-])?([0-9]+)?\.html$ /$1/show.php?itemid=$2&page=$4 last;
rewrite ^/(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ /$1/list.php?catid=$2&page=$4 last;
rewrite ^/(.*)/show/([0-9]+)/([0-9]+)?([/])?$ /$1/show.php?itemid=$2&page=$3 last;
rewrite ^/(.*)/list/([0-9]+)/([0-9]+)?([/])?$ /$1/list.php?catid=$2&page=$3 last;
rewrite ^/(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ /$1/list.php?catid=$3&page=$4 last;
rewrite ^/(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /$1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5 last;
rewrite ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3 last;
rewrite ^/(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ /index.php?homepage=$2&file=$3&rewrite=$4 last;
rewrite ^/(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ /index.php?homepage=$2&file=$3 last;
rewrite ^/(com)/([a-z0-9_\-]+)([/])?$ /index.php?homepage=$2 last;
         
           
      

应该放在那里呢?


#  power by www.phpStudy.net
#user  nobody;
worker_processes  1;

#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;
    #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;










  #gzip  on;
  gzip on;
  gzip_min_length  1k;
  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 [1-6].";

  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_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
            root   "D:/wwwww/wwwchinafilterorg/company";
        location / {
            index  index.html index.htm index.php l.php;
            
            
            

            
            
            
            
            
            
            
            
           autoindex  off;
           
   
           
           
           
           
           
        }
        
        
        

        
        
        
        
        

        #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   "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_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_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 {
        
   
        
        
        
        
        
          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  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

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

include vhosts.conf;


}
回复

使用道具 举报

95

主题

3474

回帖

8086

积分

论坛元老

Rank: 8Rank: 8

积分
8086
发表于 2017-7-10 08:30:07 | 显示全部楼层

对应站点配置文件里面的  location / {里面
回复 支持 反对

使用道具 举报

71

主题

3537

回帖

8055

积分

论坛元老

Rank: 8Rank: 8

积分
8055
发表于 2017-7-10 15:06:25 | 显示全部楼层

你站点的绑定目录在哪块
回复 支持 反对

使用道具 举报

57

主题

1729

回帖

4263

积分

论坛元老

Rank: 8Rank: 8

积分
4263
发表于 2017-7-11 18:01:57 | 显示全部楼层

站点配置文件里
回复 支持 反对

使用道具 举报

95

主题

3474

回帖

8086

积分

论坛元老

Rank: 8Rank: 8

积分
8086
发表于 2017-7-19 08:57:26 | 显示全部楼层

你的伪静态设置好了吗
回复 支持 反对

使用道具 举报

50

主题

3415

回帖

7668

积分

论坛元老

Rank: 8Rank: 8

积分
7668
发表于 2017-7-19 17:02:47 | 显示全部楼层

放在index.htm的下面
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|destoon采集论坛

GMT+8, 2025-11-23 04:51 , Processed in 0.020587 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表