ivankayzer
8/1/2019 - 11:20 AM

Dev CP Proxy Nextjs

/etc/nginx/plesk.conf.d/vhosts/dev.careersinpoland.com.conf

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 137.74.169.150:443 ssl http2;

        server_name dev.careersinpoland.com;
        server_name www.dev.careersinpoland.com;
        server_name ipv4.dev.careersinpoland.com;

        ssl_certificate             /opt/psa/var/certificates/certV8VepcN;
        ssl_certificate_key         /opt/psa/var/certificates/certV8VepcN;

        client_max_body_size 128m;

        root "/var/www/vhosts/dev.careersinpoland.com/httpdocs/public";
        access_log "/var/www/vhosts/system/dev.careersinpoland.com/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/dev.careersinpoland.com/logs/proxy_error_log";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

location / {
     expires max;
     proxy_pass http://127.0.0.1:3000;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "Upgrade";
     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_set_header X-Forward-Proto http;

}
location /(api|admin|media|storage|assets|packages|_debugbar) {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location /internal-nginx-static-location/ {
     alias /var/www/vhosts/dev.karierawfinansach.pl/httpdocs/public/;
     internal;
}

location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location ~ ^/(api|admin|media|storage|assets|packages|_debugbar) {
     proxy_pass http://137.74.169.150:7080;
     proxy_set_header Host             $host;
     proxy_set_header X-Real-IP        $remote_addr;
     proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
     access_log off;
}
location ~ ^/~(.+?)(/.*)?$ {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location ~ \.php(/.*)?$ {
     fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_pass "unix:///var/www/vhosts/system/dev.karierawfinansach.pl/php-fpm.sock";
     include /etc/nginx/fastcgi.conf;
}

}

server {
        listen 137.74.169.150:80;

        server_name dev.careersinpoland.com;
        server_name www.dev.careersinpoland.com;
        server_name ipv4.dev.careersinpoland.com;

        client_max_body_size 128m;

        root "/var/www/vhosts/dev.careersinpoland.com/httpdocs/public";
        access_log "/var/www/vhosts/system/dev.careersinpoland.com/logs/proxy_access_log";
        error_log "/var/www/vhosts/system/dev.careersinpoland.com/logs/proxy_error_log";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

location / {
     expires max;
     proxy_pass http://127.0.0.1:3000;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "Upgrade";
     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_set_header X-Forward-Proto http;

}

location /(api|admin|media|storage|assets|packages|_debugbar) {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location /internal-nginx-static-location/ {
     alias /var/www/vhosts/dev.karierawfinansach.pl/httpdocs/public/;
     internal;
}

location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location ~ ^/(api|admin|media|storage|assets|packages|_debugbar) {
     proxy_pass http://137.74.169.150:7080;
     proxy_set_header Host             $host;
     proxy_set_header X-Real-IP        $remote_addr;
     proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
     access_log off;
}

location ~ ^/~(.+?)(/.*)?$ {
     proxy_pass http://137.74.169.150:7080;
     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-Accel-Internal /internal-nginx-static-location;
     access_log off;
}

location ~ \.php(/.*)?$ {
     fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_pass "unix:///var/www/vhosts/system/dev.karierawfinansach.pl/php-fpm.sock";
     include /etc/nginx/fastcgi.conf;
}

}