quutoo 发表于 2011-3-11 19:22:55

Nginx下如何开启伪静态功能啊?

本菜鸟第一次使用这个系统。
CentOS下用LNMP一键安装包安装的系统,
我现在网站程序是DISCUZ X1.5
想开启伪静态功能,
请问各位老师:Nginx下如何开启伪静态功能啊?
请指点。
我看到Nginx里面带有discuzx.conf文件,
怎么才能调用这个啊?怎么设置???

谢谢!!

mm111111 发表于 2011-3-11 19:56:07

我是菜鸟, 希望能帮到你 。。添加虚拟主机就可以了

/root/vhost.sh

1 输入域名 ,点击y确定,回车.

2 绑定网站目录,默认在home/wwwroot里面

3 allow rewrte rule

允许伪静态,点击y确定

4 please input the rewrite of progrname

输入伪静态文件名字

默认已经有了Discuz、Wordpress、Sablog、emlog、dabr,可直接输入以上名称即可。程序会自动创建伪静态文件

5 allow access log
是否增加日志,点击n


第四步是你问题关键

[ 本帖最后由 mm111111 于 2011-3-11 20:08 编辑 ]

quutoo 发表于 2011-3-11 20:29:34

多谢兄弟指点.

quutoo 发表于 2011-3-11 21:48:27

兄弟:你说的是添加虚拟主机.
问题是我现在的域名直接指向的根目录home/wwwroot,
怎么调用伪静态规则啊??

mm111111 发表于 2011-3-11 23:35:15

添加虚拟主机, 过程中会教你输入域名和绑定目录的, 你可能说的是修改nginx.conf
增加伪静态
includexxx.conf;

备注xxx是程序名称应该和Nginx里面带有xxx.conf文件名称一致

DISCUZ X1.5的伪静态规则我不知道

licess 发表于 2011-3-12 07:30:09

回复 5# 的帖子

如果是/home/wwwroot 修改/usr/local/nginx/conf/nginx.conf,找到虚拟主机,discuzx的程序直接
include discuzx.conf;
重启nginx就行了。

quutoo 发表于 2011-3-12 08:06:51

回复 6# 的帖子

军哥:
是不是在/usr/local/nginx/conf/nginx.conf 这段里面这么加
--------------------------------------------
server
      {
                listen       80;
                server_name bbs.xxx.com;
                index index.html index.htm index.php;
                root/home/wwwroot;

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

                location /status {
                        stub_status on;
                        access_log   off;
                }

                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/wwwlogs/access.logaccess;
      }
include vhost/*.conf;
}

--------------------------------------------

quutoo 发表于 2011-3-12 08:08:39

另外一个问题:
如何才能重启nginx??
是不是这个语句:
# /usr/local/nginx/sbin/nginx -s reload

先谢了,第一次用这个系统,什么都不懂.呵呵,麻烦各位兄弟了.

quutoo 发表于 2011-3-12 08:30:44

如上所说:我在/usr/local/nginx/conf/nginx.conf 这段里面增加伪静态
include discuzx.conf;
然后在PUTTY里面执行这个指令 # /usr/local/nginx/sbin/nginx -s reload
重新启动的nginx.
然而还是不行啊.
出现的404 Not Found错误提示.
军哥帮忙啊.

im163 发表于 2011-3-12 08:37:56

安装你的描述,你应该加

include vhost/discuzx.conf;

quutoo 发表于 2011-3-12 09:16:06

军哥我把我的nginx.conf 贴出来:请指点是不是这样的 ?(我的站放在根目录下的)

userwww www;

worker_processes 1;

error_log/home/wwwlogs/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;

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

                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 256k;

                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_name bbs.quutoo.com;
                index index.html index.htm index.php;
                root/home/wwwroot;

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

                location /status {
                        stub_status on;
                        access_log   off;
                }

                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/wwwlogs/access.logaccess;
        }
include vhost/*.conf;
}

im163 发表于 2011-3-12 10:06:06

试试这个userwww www;

worker_processes 1;

error_log/home/wwwlogs/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;

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

                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 256k;

                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_name bbs.quutoo.com;
                index index.html index.htm index.php;
                root/home/wwwroot;
                include discuzx.conf;

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

                location /status {
                        stub_status on;
                        access_log   off;
                }

                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/wwwlogs/access.logaccess;
      }
include vhost/*.conf;
}

[ 本帖最后由 im163 于 2011-3-13 02:42 编辑 ]

licess 发表于 2011-3-12 11:46:05

root/home/wwwroot;
下面加上include discuzx.conf;
再/usr/local/nginx/sbin/nginx -s reload

quutoo 发表于 2011-3-12 23:12:56

回复 13# 的帖子

root/home/wwwroot;
下面加上include discuzx.conf;
OK了.
谢谢.
页: [1]
查看完整版本: Nginx下如何开启伪静态功能啊?