nginx 各种配置
2016-04-11 21:07
495 查看
first : mkdir /usr/local/nginx/conf/vhosts {网站配置}/usr/local/nginx/conf/vhosts/test.conf : server { listen 80; #跳转 server_name www.test.com www.aaa.com www.bbb.com; #全局访问限制 #deny 127.0.0.1; #deny 1.1.1.1; #跳转 if ($host != 'www.test.com') { rewrite ^/(.*)$ http://www.test.com/$1 permanent; } index index.html index.htm index.php; root /data/www; #记录登陆的日志 access_log /tmp/access.log ff; #禁止指定user_agent if ($http_user_agent ~ 'baidu|1111') { return 403; } #日志加上防盗链加上静态缓存 location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ { expires 30d; valid_referers none blocked server_names *.test.com *.aaa.com *.aminglinux.com; if ($invalid_referer) { # return 403; rewrite ^/ http://www.example.com/nophoto.gif; } #日志不记录 access_log off; } #对论坛所有php的基本设置 #location ~ \.php$ #对论坛admin.php的设置 location ~ .*admin\.php$ { #全局访问限制 allow 127.0.0.1; deny all; include fastcgi_params; #fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name; } } {代理}proxy.conf: upstream ff{ server 61.135.169.125:80; server 61.135.169.121:80 ; } server { listen 80; server_name www.baidu.com; location / { proxy_pass http://ff/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # access_log /tmp/logs/access.log combined; } {虚拟主机}default.conf server { listen 80 defaults_server; server_name 111.com; root /tmp/tmp; } after save : mkdir /tmp/tmp
相关文章推荐
- Nginx安装及配置文件nginx.conf详解
- nginx实操(1)安装及选项说明
- Nginx Location处理逻辑(优先级)权威解读
- NGINX-PHP组合
- Nginx非80端口配置
- 学习-在Centos下安装Nginx教程
- 基于centos搭建nginx+uwsgi运行django环境
- nginx+php
- nginx编译安装 1.8
- linux centos6.5 64位 安装nginx
- rd /s /q "D:\nginx-rtmp-sample-master"
- nginx增加虚拟服务器
- 阿里云centos6.7下yum安装nginx最新版
- Nginx 负载均衡策略
- Nginx 负载均衡配置和策略
- nginx直接返回
- nginx的负载均衡
- 【Nginx】ngx_event_core_module模块
- nginx配置ssl
- NGINX error