Re: Problem with aliases
On Sat, Jul 03, 2021 at 05:15:56PM -0400, yosef wrote: Hi there, > Hi again, now is working thanks a lot! Thanks for confirming, and it's good to hear that you have a working system! Cheers, f -- Francis Dalyfran...@daoine.org ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Problem with aliases
Hi again, now is working thanks a lot! Posted at Nginx Forum: https://forum.nginx.org/read.php?2,291964,291977#msg-291977 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Problem with aliases
On Thu, Jul 01, 2021 at 04:37:56PM -0400, yosef wrote: Hi there, > unfortunately I still cant get this working, now the browser is not > downloading the file, instead is showing me this message "No input file > specified" let me show you what my code looks like now: * what request do you make? (Probably something like "/proj1/index.php".) * what file on your filesystem do you want your fastcgi server to read, to process that request? (Probably something like "/var/www/proj1/public_html/index.php".) * what "fastcgi_param SCRIPT_FILENAME" value does nginx send to your fastcgi server? That last one is probably "what is inside snippets/fastcgi-php.conf?" Note that every fastcgi server is (potentially) different, and will read the "param" values sent in their own ways. But commonly, if exactly one SCRIPT_FILENAME is sent, that is what is used. You probably want something like fastcgi_param SCRIPT_FILENAME $request_filename; but other options exist, depending on details. > location ^~ /proj1 { > alias /var/www/proj1/public_html; Somewhat unrelated -- that will work, but it is probably better to add a / to both lines, so that they are location ^~ /proj1/ { alias /var/www/proj1/public_html/; so that someone requesting /proj12/ will not accidentally be shown things inside /var/www/proj1/public_html2/ Cheers, f -- Francis Dalyfran...@daoine.org ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Problem with aliases
Hi Francis, First of all, thank you very much for your help :) I took your advice, unfortunately I still cant get this working, now the browser is not downloading the file, instead is showing me this message "No input file specified" let me show you what my code looks like now: server { listen 80; listen [::]:80; index index.php; server_name 173.230.131.168; location ^~ /proj1 { alias /var/www/proj1/public_html; try_files $uri $uri/ /index.php?q=$uri&$args; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; } } location ^~ /proj2 { alias /var/www/proj2/public_html; try_files $uri $uri/ /index.php?q=$uri&$args; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; } } } Whats wrong now? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,291964,291970#msg-291970 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Problem with aliases
On Wed, Jun 30, 2021 at 07:31:43PM -0400, yosef wrote: Hi there, > Im trying to use several blocks in my server using the server IP as server > name (no domain yet), each block points to a folder containing Wordpress. I > dont know what Im doing wrong because instead of running index.php nginx is > download the file. In nginx, one request is handled in one location{}. Only the configuration in (or inherited into) that location matters. (One http request can become more than one (sub)request within nginx.) > location ^~ /proj1 { > alias /var/www/proj1/public_html; > try_files $uri $uri/ /index.php?q=$uri&$args; > } "^~" means "prefix match, and do not look at parallel regex matches". So a request for /proj1/index.php will be handled in this location{}. And this location has no fastcgi_pass or similar directive, so it will use "serve from the filesystem". Probably the simplest fix is to copy the "location ~ \.php$ {" block to be inside each of the "location ^~" blocks. Note also -- if the request is for /proj1/missing, the try_files will use the subrequest /index.php?q=/proj1/missing& -- is that what you want, instead of (e.g) /proj1/index.php?q=/proj1/missing& ? Good luck with it, f -- Francis Dalyfran...@daoine.org ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx