This is my first sites-enabled file
server {
listen 80;
listen 443 ssl;
server_name www.cobanextwithzone.test;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
text/plain
text/css
application/json
application/x-javascript
text/xml
application/xml
application/xml+rss
text/javascript
application/javascript
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
font/opentype
image/svg+xml
image/x-icon;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
and this is the second
server {
listen 80;
listen 443 ssl;
server_name www.cobanextwithzone.test;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
text/plain
text/css
application/json
application/x-javascript
text/xml
application/xml
application/xml+rss
text/javascript
application/javascript
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
font/opentype
image/svg+xml
image/x-icon;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
those to file are using same server_name, because I wanted to do microfrontends, so the second app will be served on www.cobanextwithzone.test/thesecondapp/
the problem is when sudo service nginx restart
or sudo service nginx reload
it shows this on sudo nginx -t
nginx: [warn] conflicting server name "www.cobanextwithzone.test" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.cobanextwithzone.test" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.cobanextwithzone.test" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.cobanextwithzone.test" on 0.0.0.0:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Anyone know how to serve 2 app on same server_name?
Thanks!