Nginx Location Change Ubuntu 20.04

  • Last Post 21 October 2020
Procco posted this 21 October 2020


I would like to change the location where AMP displays and instead of it displaying at, I would like it to show up at so that I can have my /var/www/html folder display at the root.

I've tried to play around with it and can't seem to figure out what is going on. I either can get my /var/www/html to display or amp to display at the root but can't get amp to display at the /amp.

Any ideas on what I could do?

Here is what I have.

server {
server_name iremovedthisbecause;

client_max_body_size 100M;
proxy_request_buffering off;
proxy_buffering off;
proxy_pass_request_body on;

location / {
    root /var/www/html;

location /amp {
    proxy_pass http://localhost:8080;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $remote_addr;
    proxy_set_header        Upgrade $http_upgrade;
    proxy_set_header        Connection "Upgrade";
    proxy_set_header        X-AMP-Scheme $scheme;
    proxy_read_timeout      86400s;
    proxy_send_timeout      86400s;
    proxy_http_version      1.1;
    proxy_redirect          off;
    proxy_buffering         off;
    client_max_body_size    10240M;
    error_page 502 /amp/NotRunning.html;

    location = /amp/NotRunning.html {
        root /opt/cubecoders/amp/shared/WebRoot;

    location /amp/shared/ {
        alias /opt/cubecoders/amp/shared/WebRoot/;

listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/iremovedthisbecause/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/iremovedthisbecause/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

Mike posted this 21 October 2020

AMP must be in its own subdomain. It cannot be in a path of another domain.