我具有以下nginx配置,以便为不同的应用程序提供不同的子域,并且遇到一些奇怪的行为。
我在这里想念什么?
server {
listen 8081;
server_name be.mydomain.com;
ssl on;
ssl_certificate /var/www/sitename/ssl/allswdomains.crt;
ssl_certificate_key /var/www/sitename/ssl/allswdomains.key;
location / {
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443;
server_name cpanel.mydomain.com;
ssl on;
ssl_certificate /var/www/sitename/ssl/allswdomains.crt;
ssl_certificate_key /var/www/sitename/ssl/allswdomains.key;
root /var/www/sitename/fe;
location / {
#try_files $uri /index.html;
}
}
server {
listen 80;
server_name mydomain.com www.mydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate /var/www/sitename/ssl/allswdomains.crt;
ssl_certificate_key /var/www/sitename/ssl/allswdomains.key;
root /var/www/sitename/website;
server_name www.mydomain.com mydomain.com;
location / {
#try_files $uri /index.html;
}
}