美文网首页
nginx用起来真是又爱又恨

nginx用起来真是又爱又恨

作者: 美雨知春 | 来源:发表于2020-11-11 18:43 被阅读0次

今天在docker上配置了一下多个域名,当然多个域名都指向80端口啊,可是原来都是好好的,怎在dockers上就是不行呢,前两天刚刚因为配置cgi受了伤,这次隐隐感到是不是同一个伤口又被提起呢,其实不是,是少复制了两句话,只凭自己的记忆配置了一下,发现自己还是内功不足啊。下面摆上我的配置成功的配置文件
nginx.conf 基本的配置文件
nginx.d/gateway.xxx.cn 域名的配置文件

前提是

yum install nginx
yum install php-fpm

把php-fpm启动起来

  1. nginx.conf
user gateway;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    include /etc/nginx/conf.d/*.conf;
    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    server {
        listen       80;
    #    listen       [::]:80 default_server;
        server_name _;
      root         /app/html/;

        include /etc/nginx/default.d/*.conf;   //这句话丢了不行,配置失败原因之一
        # Load configuration files for the default server block.
       
    location / {
    }

       location ~ \.php$ {
             root         /app/html/;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME   /app/html$fastcgi_script_name;
             include        fastcgi_params;  //这句话丢了不行,配置失败原因之一
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

}
  1. nginx.d/gateway.xxx.cn
server {
        listen       80;
    #    listen       [::]:80 default_server;
        server_name gateway.xxx.cn inno.gateway.xxx.cn ;
 root         /app/interface;
        # Load configuration files for the default server block.
  include /etc/nginx/default.d/*.conf;     
    location / {
        index  index.php;
    }

       location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /app/interface$fastcgi_script_name;
             include         /etc/nginx/fastcgi_params; //这句话丢了不行,配置失败原因之一
        } 
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

相关文章

  • nginx用起来真是又爱又恨

    今天在docker上配置了一下多个域名,当然多个域名都指向80端口啊,可是原来都是好好的,怎在dockers上就是...

  • 真是对农村又爱又恨

    真是对农村又爱又恨。 说爱咧,就是觉得住着“有天有地”的房子,比较舒服,农村的空气比较好,周围都是认识的人还可以去...

  • spring的坑

    这框架真是又爱又恨

  • 2019-06-23

    学校,真是让人又爱又恨的地方。

  • 又爱又恨

    没法释怀对这个人的恨 也没法稀释对这个人的爱

  • 又爱又恨

    2017年11月24日 星期五 今天一如既往的送孩子上学后,回来听了听父母归。后又在腾讯新闻上看了一...

  • 又爱又恨

    从十指相扣,到热烈激吻,再到十指相扣!相信每个人都会有这样得过程!也许当初的勇气来自于意气,可是到最后你还是...

  • 又爱又恨

    高中的一个男同学兼好朋友 我们无论做什么都腻在一起 上学放学吃饭上厕所上课什么的 就算成绩也几乎同步 同年级的都以...

  • 又爱又恨

    还记得么?曾经的阳光、雨滴?曾经的欢笑、泪水?如果没有忘记。如果还在想念。如果对青春的时光还念念不忘。对爱情、友情...

  • 又爱又恨

    我觉得最可怕的事情就是一个人看不到别人在相处的时候付出的,也看不到自己所拥有的,说起来可能很夸张,但很多人就是这样...

网友评论

      本文标题:nginx用起来真是又爱又恨

      本文链接:https://www.haomeiwen.com/subject/zjkybktx.html