码迷,mamicode.com
首页 > Web开发 > 详细

Nginx 配置 HTTP 代理

时间:2019-09-16 23:38:55      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:ali   worker   ram   war   error_log   content   app   form   main   

配置如下

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                     ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
 
    server { 
        # host
        server_name example.com www.example.com;
        
        #设置长连接
        keepalive_timeout 70;    
        #减少点击劫持
        add_header X-Frame-Options DENY;
        #禁止服务器自动解析资源类型
        add_header X-Content-Type-Options nosniff;
        #防XSS攻击
        add_header X-Xss-Protection 1; 
        # 默认index
        index index.html index.htm index.php default.html default.htm default.php;
        # 代码的根目录
        root  /home/wwwroot/example;
        # 访问日志
        access_log  /usr/local/nginx/logs/example.com.log  main; 
    } 
}

 

Nginx 配置 HTTP 代理

标签:ali   worker   ram   war   error_log   content   app   form   main   

原文地址:https://www.cnblogs.com/vipsoft/p/11530884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!