NGINX vhost php problem

Hello,

I'm trying to enable phpmyadmin is an directory outside of my public_html folder however I get a problem in which it doesn't load the site.

I'd like the folder to be accessed from the following URLs:

lonelystorm/phpmyadmin

lonelystorm/phpmyadmin/

lonelystorm/phpmyadmin/*

> location ~ ^/phpmyadmin(|/.*)$ {

auth_basic "Restricted";

authbasicuser_file /srv/www/lonelystorm.com/htpasswd;

alias /srv/www/lonelystorm.com/phpmyadmin/$1;

index index.php;

fastcgi_param HTTPS on;

fastcgisplitpath_info ^(.+.php)(.*)$;

fastcgi_pass backend;

fastcgi_index index.php;

fastcgiparam SCRIPTFILENAME /srv/www/lonelystorm.com/phpmyadmin/$fastcgiscriptname;

include fastcgi_params;

fastcgiconnecttimeout 60;

fastcgisendtimeout 180;

fastcgireadtimeout 180;

fastcgibuffersize 128k;

fastcgi_buffers 4 256k;

fastcgibusybuffers_size 256k;

fastcgitempfilewritesize 256k;

fastcgiintercepterrors on;

}

1 Reply

@Dead6re:

Hello,

I'm trying to enable phpmyadmin is an directory outside of my public_html folder however I get a problem in which it doesn't load the site.

I'd like the folder to be accessed from the following URLs:

lonelystorm/phpmyadmin

lonelystorm/phpmyadmin/

lonelystorm/phpmyadmin/*

> location ~ ^/phpmyadmin(|/.*)$ {

auth_basic "Restricted";

authbasicuser_file /srv/www/lonelystorm.com/htpasswd;

alias /srv/www/lonelystorm.com/phpmyadmin/$1;

index index.php;

fastcgi_param HTTPS on;

fastcgisplitpath_info ^(.+.php)(.*)$;

fastcgi_pass backend;

fastcgi_index index.php;

fastcgiparam SCRIPTFILENAME /srv/www/lonelystorm.com/phpmyadmin/$fastcgiscriptname;

include fastcgi_params;

fastcgiconnecttimeout 60;

fastcgisendtimeout 180;

fastcgireadtimeout 180;

fastcgibuffersize 128k;

fastcgi_buffers 4 256k;

fastcgibusybuffers_size 256k;

fastcgitempfilewritesize 256k;

fastcgiintercepterrors on;

}

It seems that you have control of your own domain. In that case a sub-domain set-up is more straightforward. Here is my working example loosely adapted to your domain.

server {

listen 80;

server_name phpmyadmin.lonelystorm.com;

site-specific

access_log /var/log/nginx/phpmyadmin.access.log;

location / {

root /srv/www/lonelystorm.com/phpmyadmin/;

index index.php index.html index.htm;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

site-specific

root /var/www/nginx-default;

}

location ~ .php$ {

site-specific

root /srv/www/lonelystorm.com/phpmyadmin/;

include fastcgi_params;

site-specific

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgiparam SCRIPTFILENAME /srv/www/lonelystorm.com/phpmyadmin/$fastcgiscriptname;

}

}

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct