Nginx路由问题 - http服务器和https服务器

时间:2017-11-27 16:42:54

标签: nginx devops

我的网站中有两个nginx文件可用。一个用于https域,另一个用于和http域。我有https域的路由来将https://www.domain1.com路由到http://www.domain2.com,而是路由到我已设置的http域server{ server_name http://domain1.com return 301 https://www.domain1.com$request_uri; } server { listen 443 ssl; server_name www.domain1.com; ssl_certificate /home/node/www.domain1.com.crt; ssl_certificate_key /home/node/www.domain1.com.key; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; location / { proxy_redirect off; access_log /var/log/nginx/mainacc.log; proxy_pass http://127.0.0.1:3000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; } } 。有人可以帮帮我吗?我已经尝试了google这个问题,但到目前为止没有任何帮助。

domain1设置

server {
    listen 80;
    listen [::]:80;

    server_name domain2.com www.domain2.com;

    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
    }
}

domain2设置

public static void readConfig_1(String configXmlPath)

0 个答案:

没有答案