I run nginx+php-fpm for all my sites. Some are drupal, some are standalone, some use varnish, too. All works great.
I'm installing a 1st symfony2 site -- no varnish, just nginx.
After installing symfony,
✔ Symfony 2.6.5 was successfully installed. Now you can:
I 1st check the php web-server
cd ./symfony
php app/console server:run
@ nav to:
http://127.0.0.1:8000
I see
==> "Symfony - Welcome"
& @ nav to:
http://127.0.0.1:8000/config.php
I see
==> "Your configuration looks good to run Symfony."
Next I switch to an nginx config.
Testing non-php
echo blah > web/test.txt
@ nav to:
https://symfony.lan/test.txt
I see
"blah"
Next, I added to web/config.php
...
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
+ '192.168.1.10',
+ '2001:xxx:xxxx:xxx::10'
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
...
If I nav to:
https://symfony.lan/config.php
I get in the browser
==> "Symfony - Welcome"
But @ nav to just:
https://symfony.lan
I get in the browser
Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
and in my log
==> /var/log/nginx/symfony.access.log <==
2001:xxx:xxxx:xxx::10 - - [23/Mar/2015:07:38:04 -0700] GET / HTTP/1.1 "404" 288 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0" "-"
For the nginx config I followed
http://wiki.nginx.org/Symfony
My nginx config is basically verbatim
server {
server_name www.symfony.lan;
return 301 $scheme://symfony.lan$request_uri;
}
server {
server_name symfony.lan;
listen [2001:xxx:xxxx:xxx::10]:80;
listen 192.168.1.10:80;
rewrite ^(.*) https://symfony.lan$1 permanent;
break;
}
server {
server_name symfony.lan;
listen [2001:xxx:xxxx:xxx::10]:443 ssl spdy;
listen 192.168.1.10:443 ssl spdy;
root /svr/www/symfony.lan/symfony/web;
access_log /var/log/nginx/symfony.access.log main;
error_log /var/log/nginx/symfony.error.log info;
rewrite_log off;
autoindex on;
ssl on;
include ssl.conf;
ssl_verify_client off;
ssl_certificate "ssldir/symfony.lan.crt";
ssl_trusted_certificate "ssldir/symfony.lan.crt";
ssl_certificate_key "ssldir/symfony.lan.key";
add_header Strict-Transport-Security "max-age=315360000; includeSubdomains";
add_header X-Frame-Options DENY;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass phpfpm;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
although referenced as a possible fix in other posts, executing @ web root
php app/console cache:clear --env=prod
php app/console cache:warmup --env=prod
fixes nothing here.
Is this a problem with Symony or Nginx, with my config or the apps?
What specifically do I need to change to get the 1st page working?
https://symfony.lan/app_dev.php
. Maybe you will see the cause of error or look to Symfony logs. - kba