TL;DR Nginx, compiled from source, had trouble process .php files, while with the same PHP-FPM configuration, nginx , from official Fedora repository, worked like a charm on DigitalOcean 512MB Fedora 21 x64 VPS. What is the reason behind it?
I am using DigitalOcean 512MB Droplet with Fedora 21 x64 VPS.
I compiled Nginx from source and installed it in /opt/nginx/. Here's the output of /opt/nginx/nginx -V
nginx version: nginx/1.7.10
built by gcc 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --sbin-path=/opt/nginx --without-http_autoindex_module --without-http_browser_module --without-http_empty_gif_module --without-http_geo_module --without-http_map_module --without-http_referer_module --without-http_scgi_module --without-http_split_clients_module --without-http_ssi_module --without-http_userid_module --without-http_uwsgi_module --with-http_gzip_static_module --with-http_ssl_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-openssl=openssl --with-pcre=pcre --with-zlib=zlib --with-ipv6
Till now, I was using it to serve only static pages. Today, I installed php-fpm from official Fedora repository and configured nginx (the one that I compiled from source with the above given configuration) to pass .php pages to PHP-FPM via unix sockets.
Unfortunately, I received the No input file specified
error. I've previously faced this issue, so I knew what to do. I quickly changed the file permission but it still received the same error.
After searching for hours and trying every possible solution, I was still receiving the same error. I found this thread to be sharing somewhat same issue.
I thought why not give Nginx from offical Fedora repository a try. I installed it. Stopped the previous nginx (compiled from source) with /opt/nginx/nginx -s stop
and configured the new nginx (from official Fedora repository) to pass .php to PHP-FPM to the same unix sockets.
And it worked.
My question is "Why did nginx (compiled from source) had trouble processing php while nginx, from official Fedora repository, worked like charm?". Could this be SELinux?
EDIT: More information about my setup.
Nginx (compiled from source)
- Installed in /opt/nginx/
- Serves web content from /srv
Nginx (from official Fedora repository)
- Default installation, usually /usr/sbin/nginx
- Serves content from /usr/share/nginx/html/
No input file specified
and that's very common mistake pointing to misconfiguration ofphp-fpm
.