nginx linux两个域名

1、两个tomcat互相影响:

改掉其中一个跟前一个一样的端口号;,重启不再影响;

2、微信公众号提示redirect-url 域名不一致,修改 nginx.conf 中的upstream名称为公众号后台填写的域名,即可解决;

3、存放路径:、usr/local/nginx 这个是nginx的程序路径;对应的还有安装包路径,除配置信息外,安装这个插件那个插件都是在安装路径的包里;

4、ssl的配置,ssl.conf 这名字都是自己起的:路径:

cd /usr/local/nginx/conf/vhost/

server {
    listen 443 ssl;
    server_name www.lpwyx.com;
    ssl_certificate /usr/local/nginx/cert/2720230_lpwyx.com.pem;
    ssl_certificate_key /usr/local/nginx/cert/2720230_lpwyx.com.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
    ssl_prefer_server_ciphers   on;
    location / {
       proxy_pass http://www.lpwyx.com;
    }
}
server {
    listen 443 ssl;
    server_name www.beihaoyuewen.com;
    ssl_certificate /usr/local/nginx/cert/2075610_beihaoyuewen.com.pem;
    ssl_certificate_key /usr/local/nginx/cert/2075610_beihaoyuewen.com.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
    ssl_prefer_server_ciphers on;
    location / {
       proxy_pass http://www.beihaoyuewen.com;
    }
}

 

  server{

    listen 80;

    server_name www.beihaoyuewen.com;

   location / {

                proxy_pass http://www.beihaoyuewen.com;
                }

  }

  

server{

    listen 80;

    server_name www.lpwyx.com;

   location / {

                proxy_pass http://www.lpwyx.com;
                }

  }

  nginx.conf 路径:/usr/local/nginx/conf/

user  root;
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;
upstream www.lpwyx.com{
    server localhost:8010;
}
 
upstream www.beihaoyuewen.com{
    server localhost:8011;
}
    server {
        listen       8089;
        server_name  47.97.230.61;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ .php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
######################### vhost ##############################
 include vhost/*.conf;
}

  

www.beicaiduo.com
原文地址:https://www.cnblogs.com/hoge66/p/11826458.html