zyypp 发表于 2009-10-12 23:43:34

你第二段 就是 多了一个 }

cpuer 发表于 2009-10-12 23:45:08

回复 30# 的帖子

moltown.com/bbs和moltown.com/my可不是域名哦,你只要/home/www/绑定域名moltown.com就行了哈,后面的server段都可以删除掉,第一个server段写成

server
      {
                listen       80;
                server_name www.moltown.com moltown.com;
                index index.html index.htm index.php;
                root/home/www;

                #limit_conn   crawler20;

                #location /status {
                #stub_status      on;
                #access_log      off;
                #}

location /bbs {
            rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            rewrite ^/forum-(+)-(+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/thread-(+)-(+)-(+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
            rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
            break;
      }

                location ~ .*\.(php|php5)?$
                        {
                              fastcgi_passunix:/tmp/php-cgi.sock;
                              #fastcgi_pass127.0.0.1:9000;
                              fastcgi_index index.php;
                              include fcgi.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                              expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                              expires      12h;
                        }

                log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log/home/logs/access.logaccess;
      }

然后后面的server段都可以删除了。

zyypp 发表于 2009-10-12 23:45:50

原帖由 mojave 于 2009-10-12 23:41 发表 http://hostloc.wiki/images/common/back.gif
/home/www/bbs    moltown.com/bbs
/home/www/my   moltown.com/my
日志是公用的吧/home/logs/access.log


server 放的是 域名
你要是 要 一个域名 后面 跟 目录的bbs和 my 的话 那就只用一个 server端了

zyypp 发表于 2009-10-12 23:48:37

userwww www;

worker_processes 1;

error_log/home/logs/nginx_error.logcrit;

pid      /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
{
use epoll;
worker_connections 51200;
}

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

#charsetgb2312;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;

sendfile on;
tcp_nopush   on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;

gzip on;
gzip_min_length1k;
gzip_buffers   4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css application/xml;
gzip_vary on;

#limit_zonecrawler$binary_remote_addr10m;

server
{
    listen       80;
    server_namemoltown.com;
    index index.html index.htm index.php;
    root/home/www;

location /bbs {
            rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            rewrite ^/forum-(+)-(+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/thread-(+)-(+)-(+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
            rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
            break;
}

location /my {
if ($host != 'moltown.com/my' ) {
      rewrite^/(.*)$http://moltown.com/my/$1permanent;
}
      rewrite ^/(post|record|sort|author|page)-(+)\.html$ /index.php?$1=$2;
      rewrite ^/tag-(.+)\.html$ /index.php?tag=$1;
}

    location ~ .*\.(php|php5)?$
    {      
      fastcgi_passunix:/tmp/php-cgi.sock;
      fastcgi_index index.php;
      include fcgi.conf;
    }
   
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv)$
    {
      expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
      expires      12h;
    }   

    log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log/home/logs/access.logaccess;
}
}

cpuer 发表于 2009-10-12 23:49:42

回复 34# 的帖子

一直没弄明白 里面的

      rewrite ^/(post|record|sort|author|page)-(+)\.html$ /index.php?$1=$2;
      rewrite ^/tag-(.+)\.html$ /index.php?tag=$1;

这段是用来干啥的?

zyypp 发表于 2009-10-12 23:52:40

应该是 一个 blog 的 rewrite 规则吧 呵呵

cpuer 发表于 2009-10-12 23:53:48

回复 36# 的帖子

哦了,楼主去试试吧 :D

zyypp 发表于 2009-10-12 23:57:41

对了 楼主 哪些 rewrite 你最好 自己 重新 写下 我不知道 给你放的 对不对

cpuer 发表于 2009-10-12 23:58:19

回复 38# 的帖子

discuz那个是对的,其他未知。

zyypp 发表于 2009-10-13 00:01:09

回复 39# 的帖子

哦 呵呵
页: 1 2 3 [4] 5 6
查看完整版本: nginx静态规则这样添加为何不行,该如何改