zoukankan      html  css  js  c++  java
  • CentOS 搭建 nginx + tomcat

    安装nginx

    yum install nginx 

    修改 nginx.conf, (/etc/nginx/nginx.conf), 网上有人做人所有配置项目的详解。

    #nu For more information on configuration, see:
    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user              nginx;
    worker_processes  8;
    
    error_log  /var/log/nginx/info.log;
    #notic_log  /var/log/nginx/notice.log  notice;
    #info_log  /var/log/nginx/info.log  info;
    
    pid        /var/run/nginx.pid;
    worker_rlimit_nofile 51200;
    
    
    events {
        use epoll;	
        worker_connections  1024;
    }
    
    
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 8m;
    
        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  /var/log/nginx/access.log  main;
    
        sendfile        on;
        tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        gzip  on;
        
       upstream backend{
         server localhost:8080;
    server 115.159.50.227:8080; } server{ listen 80; server_name www.ppmingpian.cn; location / { root /home/nginx/ppmingpian; index index.htm home.htm; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://backend; } log_format access "$remote_addr - $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for"; access_log /var/log/access.log access; } # Load config files from the /etc/nginx/conf.d directory # The default server is in conf.d/default.conf include /etc/nginx/conf.d/*.conf; }

    启动nginx

    ngnix

    关掉ngnix

    kill -HUP `cat /var/run/nginx.pid`

     添加动静分离

    nginx.conf

  • 相关阅读:
    缩点【洛谷P1262】 间谍网络
    模板-割点
    Tarjan缩点+LCA【洛谷P2416】 泡芙
    模拟赛 10-20考试记
    BFS【bzoj1667】: [Usaco2006 Oct]Cows on Skates滑旱冰的奶牛
    最短路【bzoj2464】: 中山市选[2009]小明的游戏
    linux /dev/mapper/centos-root 被占满
    Centos7中安装Mysql8并修改密码策略并远程连接
    Centos7中PHP编译安装mysqli扩展报错
    Linux中Composer 在安装依赖包与本地php版本不符问题
  • 原文地址:https://www.cnblogs.com/BenWong/p/4973309.html
Copyright © 2011-2022 走看看