Hi all,
Would someone who knows nginx be able to help me please set up my server conf file so it works and hides my app URL and replaces it with the domain I have registered?
Many thanks in advance!
Phil
Current site URL: https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/r/dev/aussietennis/
I have a domain which is: aussietennis.club which formwards to a VM with nginx running on 140.238.84.46. This should then forward traffic to the above. In a perfect world, the above URL would look as https://aussietennis.club
When the site is navigated, all traffic should show URLS as follows: https://aussietennis.club/ords/r/dev/aussietennis/create-game?clear=10&session=107131688432281 etc etc
and not the following which is valid but is not using the domain I've got:
https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/r/dev/aussietennis/create-game?clear=10&session=107131688432281
My conf file is below:
server {
server_name aussietennis.club www.aussietennis.club;
root /usr/share/nginx/html/aussietennis.club;
index index.html;
try_files $uri /index.html;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aussietennis.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aussietennis.club/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
location /ords/r/ {
rewrite ^(/ords/r)/?$ $1/f?p=106;
proxy_pass https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/;
proxy_set_header Origin "" ;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
location /i/ {
proxy_pass https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/i/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
if ($host = www.aussietennis.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = aussietennis.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name aussietennis.club www.aussietennis.club;
return 404; # managed by Certbot
Would someone who knows nginx be able to help me please set up my server conf file so it works and hides my app URL and replaces it with the domain I have registered?
Many thanks in advance!
Phil
Current site URL: https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/r/dev/aussietennis/
I have a domain which is: aussietennis.club which formwards to a VM with nginx running on 140.238.84.46. This should then forward traffic to the above. In a perfect world, the above URL would look as https://aussietennis.club
When the site is navigated, all traffic should show URLS as follows: https://aussietennis.club/ords/r/dev/aussietennis/create-game?clear=10&session=107131688432281 etc etc
and not the following which is valid but is not using the domain I've got:
https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/r/dev/aussietennis/create-game?clear=10&session=107131688432281
My conf file is below:
server {
server_name aussietennis.club www.aussietennis.club;
root /usr/share/nginx/html/aussietennis.club;
index index.html;
try_files $uri /index.html;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aussietennis.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aussietennis.club/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
location /ords/r/ {
rewrite ^(/ords/r)/?$ $1/f?p=106;
proxy_pass https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/ords/;
proxy_set_header Origin "" ;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
location /i/ {
proxy_pass https://aqmrgdtevbjxsky-pprdb.adb.uk-london-1.oraclecloudapps.com/i/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
if ($host = www.aussietennis.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = aussietennis.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name aussietennis.club www.aussietennis.club;
return 404; # managed by Certbot