NGINX configuration for NextJS

server{

	server_name abc.com;

	location /_next/ {

        	alias /var/www/website/.next/ ;
        	gzip_static on;
    		expires max;
    		add_header Cache-Control public;

    	}

    	location / {
        	proxy_pass http://127.0.0.1:8080;
        	proxy_set_header Host $host;
       	 	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;
    	}

	location /favicon/ {

        	root /var/www/website/public/favicon.ico ;
    	}   	


}
pm2 start --name=ababil-frontend npm -- start

Leave a Comment

Your email address will not be published.