I am trying to run a Silex app within a subdirectory on one of my droplets. While I understand there’s plenty of results for this in google, nothing seems to work, so I’m hoping the community can help me out here. My server has two vhosts currently. A default that’s setup on one domain, and another on another domain. I only mention there are two in case that seems to be part of my issue. My default host config:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /usr/share/nginx/some.other.domain.name;
index index.php index.html index.htm;
server_name some.other.domain.name;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Everything works fine with it. My other server is kind of a catch-all for projects I work on, so there’s several subdirectories; all of them work fine, but there’s also not much too them. They’re either a monolithic quick and dirty php scripts and some are even just static html files. They all work fine, but the one subdirectory that uses Silex supposedly returns an Error 500. I say supposedly, because there’s no error logged by nginx or php-fpm. I’ve changed log files around to make sure they were working and even triggered errors to make sure the files were writable. Everything works as expected. Literally all the other subdirectories simply work, but Silex needs to “rewrite” urls for index.php (from their docs). I’ve tried a number of things but this is where I’ve landed for the config:
server {
listen 80;
root /usr/share/nginx/some.awesome.domain.name;
index index.php index.html index.htm;
server_name some.awesome.domain.name;
location / {
try_files $uri $uri/ =404;
}
location /silexApp {
try_files $uri /silexApp/index.php$is_args$args;
location ~ ^/index\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Is there anything that stands out to anyone? Am I completely overlooking something?? I’m still new to Nginx.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
FTR, this more or less works. It turns out I had some other extremely odd issue going on. Thank goodness for sys admin friends.
please I have a big problem with error 500 and no luck with the logs.i had deleted all the logs and suddenly nothing seems to show in them anymore.can anyone help