Configuring nginx with php5-fpm for joomla site - php

I'm trying to rise up web site on joomla3 with php5-fpm and nginx. It works, but only the main page. Other pages with .html extentions like this '/reports/april.html' aren't work, it returns 404 not found error. I guess something missed in my nginx config file, please give me a hint.
server{
server_name acbr.loc;
access_log /var/log/nginx/acbr.access.log;
error_log /var/log/nginx/acbr.error.log;
root /home/oleshko/design/acbr;
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# порядок индексов
location /
{
index index.php index.html index.htm;
}
}

docs.joomla.org/Nginx
off cause )))

Related

Routing php requests with nginx using fastcgi results in 404 error

I'm new to nginx and want to configure it so the user can access URLs like
http://[ip_address]/dev/index.php/customer/account/login/
I think this may be related to using FastCGI to process the request and pass it to Magento. However, whenever I access it, i see a 404 message. I can confirm that the user running nginx and owning the directory and files is www-data. So it has access to it. I need help configuring nginx & FastCGI properly so the request loads the correct page.
All of my application is in dev/ folder. Here's the relevant chunk of default file in /etc/nginx/sites-available/defaul:
root /var/www;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _ test.xxx.com;
location /dev/ {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
}
location /dev/app/ {
deny all;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
Here is my nginx config. May help you.
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_read_timeout 900;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}

Nginx showing 404 instead of php page

I have nginx installed and if I go to uberdrivingparttime.app/ I get the usual "Welcome to nginx!" screen. I put an index.php in the folder with phpinfo(); and when I go to uberdrivingparttime.app/index.php, I get a 404! Here is my server blcok from config. Hopefully someone knows what's up!
server {
listen 80;
server_name www.uberdrivingparttime.com uberdrivingparttime.com;
access_log /srv/www/uberdrivingparttime.com/logs/access.log;
error_log /srv/www/uberdrivingparttime.com/logs/error.log;
location / {
root /srv/www/uberdrivingparttime.com/public_html;
index index.html index.htm index.php;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/uberdrivingparttime.com/public_html$fastcgi_script_name;
}
}
I am a tired, stupid, idiot.
So, everything is good here except for the fact that in /etc/hosts I have .app. The directory where the files are located are .com! Switching the server line to .app fixed everything.
Wow.

White page with Nginx Php-fpm and no errors logged

I have a server running with archlinux, nginx and Php-fpm and when I try to load a page all I get is a white page.I've tried multiple fixes found on the internet but none have worked for me.
Here is my nginx conf file :
server {
listen 80;
root /home/www-data/websites/subdomain.domain.net;
index index.php index.html index.htm;
server_name subdomain.domain.net;
access_log /root/logs/nginx/subdomain.access.log;
error_log /root/logs/nginx/subdomain.error.log;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \ (gif|jpg|png) {
expires 30d;
}
location ~ ^/favicons/.*$ {
try_files $uri /data/$uri;
}
location / {
index index.php index.html index.htm;
try_files $uri /public/$uri /index.php$is_args$args;
}
}
The error logs of both nginx & subdomain.error.log are empty.
The file is located in /home/www-data/websites/subdomain.domain.net/index.php and contains the following :
<?php phpinfo() ?>
Any help would be appreciated :)
I installed a fresh debian install and everything works now

NginX with FastCGI and WordPress in a subdirectory - "No input file specified"

I'm trying to migrate a WordPress blog to a subdirectory of my website (i.e. example.com/blog/). Using NginX and FastCGI, I've managed to get the entire WordPress site working on port 8080, but as soon as I attempt to apply rules to place it in /blog, I get "No input file specified"
I think because I can get PHP and WordPress working, I can assume that there are no issues with my installation or the permissions of the relevant folders.
This is what my virtual host looks like (I am running a rails site at "/"):
server {
listen 80;
server_name example.com localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /blog/ {
root /home/deploy/www/blog.example.com/html;
index index.php;
try_files $uri $uri/ /blog/index.php;
}
location ~ \.php$ {
root /home/deploy/www/blog.example.com/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
root /home/deploy/www/example.com/public;
passenger_enabled on;
index index.html index.htm;
}
I have also tried this configuration for the same result:
location ~ ^/blog/.*(\.php)?$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
root /home/deploy/www/blog.example.com/html;
try_files $uri =404;
# fastcgi_split_path_info ^(/blog/.+\.php)(.*)$;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
What am I doing wrong?
Are you using WordPress with Multisite?
I am not clear about your setup, but a tutorial from this list will surely help you: http://rtcamp.com/wordpress-nginx/tutorial
If you can share more details, I can guide you better.
From where does 8080 coming into picture? R u using Nginx with Apache??
"No input file specified" looks like an error related to incorrect location of PHP file...
Try changing
enter code herefastcgi_index index.php;
to
try_files index.php blog/index.php
Assuming 'blog' is a folder where you moved your WordPress.

Nginx config file isn't locating my Codeigniter/PHP app

I can't figure out how to make the Nginx config file locate my Codeigniter app. Serving PHP on this server is not the problem b/c if I put a php file in my root directory, I can echo "hello world";.
Here's my Nginx config file which is nearly verbatim from this tutorial. Note that I've manipulated many of these parameters and none had an effext so I'm wondering whether I need to look beyond this file to get it to work?:
server {
listen 80;
server_name www.mysite.com mysite.com;
root /var/www;
index index.html index.php index.htm;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
I've been thinking all along this is a simple path issue b/c Codeigniter has a somewhat confusing routing structure but just can't see the problem with my config. Thoughts?
Everything up top matches what I have for a CI project, then this is my location config:
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Not sure if by removing the wildcard * would help, or getting rid of the split_info param...

Categories