Welcome! Log In Create A New Profile

Advanced

config nginx to have two websites

Posted by lorell 
config nginx to have two websites
April 17, 2019 06:46PM
Lorell2
Members
1 post

Report post

Posted 1 minute ago

I installed Resilio on a new/clean Ubuntu 18.04 server by following these instructions.

https://www.linuxbabe.com/ubuntu/install-resilio-sync-btsync-ubuntu-18-04-18-10

Because the server is in the cloud, I installed the reverse-proxy nginx proxy following the same instructions.

When I browse to the public hostname of the device it works quite well (even using https!). It automatically appends /gui/ to the end of my URL.

I would like to be able to browse to the same web server in a different directory to access regular html pages and use a subfolder for Resilio Sync.

Currently, I browse to https://fake.hostname.org and am redirected to https://fake.hostname.org/gui/ and the web UI for Resilio Sync comes up. I would like to browse to https://fake.hostname.org and get regular HTML pages in the regular nginx HTML folder ( /var/share/nginx/html/ ? ). And I would like to browse to https://fake.hostname.org/resilio and get the Resilio Sync UI. How do I go about doing this?

This would allow me to use the server as both a regular webserver and as Resilio Sync server.

Thanks!

Here is my current /etc/nginx/conf.d/resilio-sync.conf:

server {
server_name fake.hostname.org;

access_log /var/log/nginx/resilio_access.log;
error_log /var/log/nginx/resilio_error.log;
location / {
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/fake.hostname.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/fake.hostname.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot


ssl_trusted_certificate /etc/letsencrypt/live/fake.hostname.org/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot

}
server {
if ($host = fake.hostname.org) {
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name fake.hostname.org;

access_log /var/log/nginx/resilio_access.log;
error_log /var/log/nginx/resilio_error.log;
location / {
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready