zoukankan      html  css  js  c++  java
  • nginx 各种配置

    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
  • 相关阅读:
    linux下git以及github的连接与使用
    在windows上如何安装python web引擎jinja2
    JS请求服务器并使页面跳转(转)
    Spring MVC中Session的正确用法<转>
    Eclipse上安装GIT插件EGit及使用
    深入理解JavaScript事件循环机制
    React Hooks useContext 进行父子组件传值
    Remove all your local git branches but keep master
    常见的web前端性能优化
    js知识梳理2:对象属性的操作
  • 原文地址:https://www.cnblogs.com/frankielf0921/p/5380172.html
Copyright © 2011-2022 走看看