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.
Related
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 )))
For some reason, my nginx installation is running some .php files properly, while doesn't.
I have some files:
upload.php, sig.php, popup.php - executes and works.
asdfsda.php - doesn't work, when I visit it, the file downloads.
(SOLVED by clearing browser cache) visiting my domain - downloads my index.html file with the name "download", when I visit mydoma.in/index.html, I can see my index file properly.
I have no idea what could cause this issue.
I tried:
reinstalling PHP5-FPM
restarting the server
restarting nginx/php5-fpm services
chmod files to 777
Related nginx config part:
root /boot/www;
index index.html index.php;
server_name - my domain here -;
location / {
try_files $uri $uri/ =404;
}
location /upload.php {
include php5.conf;
}
location /asdfsda.php {
include php5.conf;
}
location /popup.php {
include php5.conf;
}
location /sig.php {
include php5.conf;
}
php5.conf:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
This issue started today, I didn't change anything in my config files recently.
It worked fine yesterday.
I'll appreciate any help, thanks!
UPDATE: If I change the name of asdfsda.php file that doesn't execute to something else, it actually does execute. For example, I renamed it to d.php and changed the config entry from asdfsda to d and it executed.
What is wrong?
Why not use this?
location ~ ^/(upload|asdfsda|popup|sig)\.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
I'm having an issue where when I go to the /public directory it shows the Laravel app as normal, but navigating away to any other page results in it saying
No input file specified.
I am using an Nginx server with PHP 5.5.9 FPM.
I've scoured google for the last 4 hours or so, looking at every tutorial and stackoverflow page for rewriting issues in Laravel however they all yield the same result.
I've even set all the files and folders to 777 so I could see if it was some sort of permissions issue. I've checked the Laravel config and it's all set, I've no idea what is wrong.
Can anyone point me in the right direction?
The last config I tried is below:
server {
listen 80 default_server;
root /usr/share/sites/base;
index index.php
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}
I have also tried many others such as:
server {
listen 80;
server_name domain.com;
root /usr/share/sites/base;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
# Server PHP config.
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
The error "No input files specified" will nearly always be related to the fact that the wrong path was sent to php.
Looking at your 'last config tried' I can see that fastcgi_param SCRIPT_FILENAMEis not defined in your php location. You should first begin by defining it in the location :
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
}
Furthermore you say that you can reach the app so this means that index.php is working but not when you change page. So the problem should also come from /index.php?$args. Indeed, using this line if I try to reach yourserver.com/test and if 'test' is not a file in your root path nginx will then try request /index.php? (I had this probem). You should try only with /index.php.
EDIT : The solution was that root directive should point to the Laravel public folder, in that case /usr/share/sites/base/public.
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.
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...