xulei_928 发表于 2011-3-21 17:42:15

nginx禁止输入IP访问网站应该怎么设置?

刚才查了一下军哥回答过~~

server{
      listen 80 default; #参数表示这个是默认虚拟主机
      server_name _;
      rewrite ^(.*) https://www.vpser.net permanent; #跳转到域名
      #return 500; #或者返回 500;
}

但是这段代码该用在哪里呢?麻烦解答一下~

licess 发表于 2011-3-21 18:01:57

回复 1# 的帖子

修改/usr/local/nginx/conf/nginx.conf 中的server那一段

xulei_928 发表于 2011-3-22 09:32:13

:victory: :handshake

quutoo 发表于 2011-3-24 17:09:43

我也想知道,加哪里的?

kumotobi 发表于 2011-5-9 14:06:51

原帖由 licess 于 2011-3-21 18:01 发表 https://bbs.vpser.net/images/common/back.gif
修改/usr/local/nginx/conf/nginx.conf 中的server那一段
军哥可以详细一点吗? - -

licess 发表于 2011-5-9 15:58:08

回复 5# 的帖子

:L
server那一段里的
server_name

asmon 发表于 2011-6-30 02:32:12

还不懂的,按照下面修改/usr/local/nginx/conf/nginx.conf里面内容,前后的内容我都给出来了,还不会的就去跳河死!
========================
                gzip_types       text/plain application/x-javascript text/css application/xml;
                gzip_vary on;

                #limit_zonecrawler$binary_remote_addr10m;

server
        {
                listen 80 default;
                return 500;
        }

server
        {
                listen       80;
                server_name 123.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;

asmon 发表于 2011-7-4 19:17:31

好像下面这样也可以!


                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 default;
                return 500;
                server_name 123.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;
                        }

                location /status {
                        stub_status on;
                        access_log   off;

licess 发表于 2011-7-5 08:45:51

回复 8# 的帖子

放这里是肯定没问题,但123.com的虚拟主机必须删掉,重新添加到别的目录。

asmon 发表于 2011-7-10 15:11:28

下面的这个最简单!再用/root/vhost.sh添加虚拟主机,把网站弄到二级目录里面用就ok啦!/home/wwwroot目录里面不要放网站,哈哈!

                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 default;
                return 500;

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

                location /status {
                        stub_status on;
                        access_log   off;

admin888 发表于 2011-7-21 12:53:24

完全看不懂啊,研究下下

lnmpuser 发表于 2011-7-21 17:03:44

我也来学习一下。。。。

ccloving 发表于 2012-1-15 14:26:13

最新的0.8版如果按照这个方法,会造成wordpress提示“No input file specified.”
页: [1]
查看完整版本: nginx禁止输入IP访问网站应该怎么设置?