VPS侦探论坛

 找回密码
 注册
查看: 21070|回复: 12

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

[复制链接]
发表于 2011-3-21 17:42:15 | 显示全部楼层 |阅读模式

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

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


但是这段代码该用在哪里呢?麻烦解答一下~
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-3-21 18:01:57 | 显示全部楼层

回复 1# 的帖子



修改/usr/local/nginx/conf/nginx.conf 中的server那一段
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2011-3-22 09:32:13 | 显示全部楼层

美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-3-24 17:09:43 | 显示全部楼层



我也想知道,加哪里的?
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-5-9 14:06:51 | 显示全部楼层

原帖由 licess 于 2011-3-21 18:01 发表
修改/usr/local/nginx/conf/nginx.conf 中的server那一段

军哥可以详细一点吗? - -

军哥运维代购:http://shop63846532.taobao.com/

发表于 2011-5-9 15:58:08 | 显示全部楼层

回复 5# 的帖子



server那一段里的
server_name
发表于 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_zone  crawler  $binary_remote_addr  10m;

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_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-7-4 19:17:31 | 显示全部楼层

好像下面这样也可以!


  1.                 gzip on;
  2.                 gzip_min_length  1k;
  3.                 gzip_buffers     4 16k;
  4.                 gzip_http_version 1.0;
  5.                 gzip_comp_level 2;
  6.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  7.                 gzip_vary on;

  8.                 #limit_zone  crawler  $binary_remote_addr  10m;

  9. server
  10.         {
  11.                 listen 80 default;
  12.                 return 500;
  13.                 server_name 123.com;
  14.                 index index.html index.htm index.php;
  15.                 root  /home/wwwroot;

  16.                 location ~ .*\.(php|php5)?$
  17.                         {
  18.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  19.                                 fastcgi_index index.php;
  20.                                 include fcgi.conf;
  21.                         }

  22.                 location /status {
  23.                         stub_status on;
  24.                         access_log   off;
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-7-5 08:45:51 | 显示全部楼层

回复 8# 的帖子



放这里是肯定没问题,但123.com的虚拟主机必须删掉,重新添加到别的目录。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-7-10 15:11:28 | 显示全部楼层



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

  1.                 gzip on;
  2.                 gzip_min_length  1k;
  3.                 gzip_buffers     4 16k;
  4.                 gzip_http_version 1.0;
  5.                 gzip_comp_level 2;
  6.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  7.                 gzip_vary on;

  8.                 #limit_zone  crawler  $binary_remote_addr  10m;

  9. server
  10.         {
  11.                 listen 80 default;
  12.                 return 500;

  13.                 location ~ .*\.(php|php5)?$
  14.                         {
  15.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  16.                                 fastcgi_index index.php;
  17.                                 include fcgi.conf;
  18.                         }

  19.                 location /status {
  20.                         stub_status on;
  21.                         access_log   off;
复制代码
发表于 2011-7-21 12:53:24 | 显示全部楼层

完全看不懂啊,研究下下
发表于 2011-7-21 17:03:44 | 显示全部楼层

我也来学习一下。。。。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2012-1-15 14:26:13 | 显示全部楼层
最新的0.8版如果按照这个方法,会造成wordpress提示“No input file specified.”
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 03:56 , Processed in 0.030097 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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