Home > other >  Local Nginx reverse proxy to Laradock's Nginx
Local Nginx reverse proxy to Laradock's Nginx

Time:02-10

I have 2 websites A and B hosted on the same machine. A is an old website using laravel, which is containerized using laradock. B is a new website using Next.js and containerized by my self using docker-compose.

I've already change Nginx's port in laradock (website A) from 80 to 2080.

Now I want A.com goes to A, B.com goes to B. So I installed Nginx on the machine, and set up reverse proxy.

B works just fine. However, A's static files like images, css, js is not working correctly.

I wonder if there's another workaround, or I can just twist my reverse proxy configs to make it work.

Here's my local Nginx reverse proxy config:

server {
    # SSL configuration
    
    listen 443 ssl;
    listen [::]:443 ssl;

    root /home/admin/A_src_directory;

    server_name A.com;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:2080;
    }

CodePudding user response:

  •  Tags:  
  • Related