Nginx white page with no error - nginx

I'm new to nginx. I'm trying to use kubernetes with nginx. But I get a blank page and no error... what can I do ?
Here my configuration :
server {
listen 80;
root /var/www/project/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# DEV
# This rule should only be placed on your development environment
# In production, don't include this and don't deploy app_dev.php or config.php
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
#internal;
}
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;
}
Edit :
I run it in a docker-compose, now I get this when I launch :
web_1 | * Restarting PHP5 FastCGI Process Manager php5-fpm
Edit 2
connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file
or directory) while connecting to upstream

Related

Magento2 NGINX run external PHP scripts

Magento2 site setup on AWS with NGINX. Site working fine.
I am trying to allow PHP scripts to run if they are in a specific folder, but they always 404.
I have placed the following inside my nginx config file, and restarted nginx:
location /custom_tests/ {
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_buffers 1024 4k;
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
I am trying to access scripts that are in sub directories of the 'custom_tests' folder, but i have also added an index.php in the 'custom_tests' folder itself. All i get is 404 not found.
I have the above NGINX entry just above the following block in the config file:
# PHP entry point for main application
location ~ (index|get|static|report|404|503|health_check)\.php$ {

403 Forbidden error in phpmyadmin

I am trying to run rails application on ubuntu14.04 , after installing phpMyAdmin , nginx unable to load phpmyadmin
nginx error log
nginx/html/phpmyadmin/" is forbidden
Within your Nginx conf.d folder (For Ubuntu location is /etc/nginx/conf.d) create one default.conf file if not already available and put the below code block. Sample conf file you can check here. You can use the server block to begin with.
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

symfony2 on nginx 500 internal server error

I am new to symfony. I am trying to setup symfony2 on ubuntu server with nginx. but it shows 500 internal server error. I have this server running some laravel projects as well and its find
Anyone can help what the problem is?
my nginx configuration is :
server {
listen 80;
root /home/ubuntu/test-symfony/web;
index app.php;
# Make site accessible from http://localhost/
server_name symfony.jonesjapriady.com http://symfony.jonesjapriady.com;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
location / {
try_files $uri /app.php?$query_string;
}
location ~ ^/(app_dev|app_test.php|app)\.php(/|$) {
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
}
}

Install symfony2 on nginx not load css

I have a problem, I want to install symfony2 on nginx, the framework is installed but is not loaded css,js,img. So I view only the home page without style. My installation :
server {
listen 80;
server_name symfony.dev;
root /home/vagrant/Workspace/symfony/web;
access_log off;
error_log /var/log/nginx/symfony.dev-error.log error;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
I looked in /etc/nginx/nginx.conf, there is :
include /etc/nginx/mime.types;
And in mime.types exists css,js, etc.
Help me please!
Thnx in advance
You have to execute this command to install the assets in web directory :
php app/console assets:install

nginx rule for specific php file

I use nginx with modsecurity and php-fpm on my web server.
I use OWASP ModSecurity Core Rule Set.
I'm trying to use some specific rules for one php file (contact.php)
Here is my nginx config:
location /contact.php {
ModSecurityEnabled on;
ModSecurityConfig ../owasp-modsecurity-crs/modsecurity_rule1.conf; # Specific rules for this file
}
location ~ \.php$ {
root /home/user/public_html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
ModSecurityEnabled on;
ModSecurityConfig ../owasp-modsecurity-crs/modsecurity.conf;
}
When I run with this config I get "500 Internal Server Error"
And this error in the php-fpm 's error.log file:
2015/01/28 05:43:01 [alert] 1395#0: *1 no upstream configuration, client: IPAdress, server: example.com, request: "POST /contact.php HTTP/1.1", host: "www.example.com", referrer: "https://www.example.com/"
I guess there is a confusion with the two "location" blocks.
How to figure this out?
location /contact.php has no upstream configured. You must copy-paste all remaining directives from second location
or if you want to keep it DRY maybe this will work:
http {
map $request_uri $mod_sec_config {
/contact.php modsecurity_rule1.conf;
default modsecurity.conf;
}
}
.....
location ~ \.php$ {
root /home/user/public_html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
ModSecurityEnabled on;
ModSecurityConfig ../owasp-modsecurity-crs/$mod_seq_config;
}
Not sure if this will work though, and according to nginx authors copy-paste is the right way of writing configs

Resources