h5bp / server-configs-nginx

Nginx HTTP server boilerplate configs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

please help me with this issue

1988gadocansey opened this issue · comments

i have a vps running django but i want to host php app called blog also on it to be access at 45.23.122.10/portal
am getting whitescreen

server {
listen 80;
listen [::]:80;
server_name #######

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/tpconnect/myproject;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/home/tpconnect/myproject/myproject.sock;
}
location ~/blog/.*\.php$ {
    root /var/www/html/blog;
    index index.php index.html index.htm;
    set $php_root /var/www/html/blog;
    try_files $uri $uri/ /index.php?$is_args$args;
   fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    #fastcgi_pass:9000;
    fastcgi_index  index.php;
    #fastcgi_param  SCRIPT_FILENAME  $php_root$fastcgi_script_name;
    #fastcgi_param SCRIPT_FILENAME /var/www/html/blog$fastcgi_script_name;
    #include /etc/nginx/fastcgi_params;

    include fastcgi_params;

    #fastcgi_param   PATH_INFO  $fastcgi_path_info;
     #   fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}


location /blog {
        root /var/www/html/blog;
        index index.php index.html index.htm;
       set $php_root /var/www/html/blog;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            #fastcgi_pass:9000;
        fastcgi_index  index.php;
       #fastcgi_param  SCRIPT_FILENAME  $php_root$fastcgi_script_name;
        #fastcgi_param SCRIPT_FILENAME /var/www/html/blog$fastcgi_script_name;
        #include /etc/nginx/fastcgi_params;
        try_files $uri $uri/ /index.php?$is_args$args;

include fastcgi_params;

   # fastcgi_param   PATH_INFO         $fastcgi_path_info;
       # fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location /portal {
        root /var/www/html/portal;
        index index.php index.html index.htm;
       set $php_root /var/www/html/portal;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            #fastcgi_pass:9000;
        fastcgi_index  index.php;
        #fastcgi_param SCRIPT_FILENAME /var/www/html/portal$fastcgi_script_name;
        #include /etc/nginx/fastcgi_params;
        try_files $uri $uri/ /index.php?$is_args$args;

include fastcgi_params;

    #fastcgi_param   PATH_INFO         $fastcgi_path_info;
       # fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# I have tried it with and without this part

location ~ .php$ {
#try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
#fastcgi_pass:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#include fastcgi_params;
include fastcgi_params;

    #fastcgi_param   PATH_INFO         $fastcgi_path_info;

       #fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

}
}

This is not a help forum. Please ask on stack overflow or similar.