Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Mar 23, 2015 9:26 am 
Offline
Senior Newbie

Joined: Tue Mar 16, 2010 5:15 am
Posts: 5
Location: Melbourne, Australia
Hi everyone,

I am having some difficulty with try_files under nginx. I followed this guide for setting up nginx with PHP and MySQL - https://www.linode.com/docs/websites/le ... n-7-wheezy

I have a Wordpress blog (in this post I have changed it to example.com for privacy reasons) and it looks like this:

Code:
server {
    listen   80;
    server_name www.example.com example.com;
    access_log /srv/www/example.com/logs/access.log;
    error_log /srv/www/example.com/logs/error.log;

    location / {
        root   /srv/www/example.com/public_html;
        index  index.html index.htm index.php;
    }

    location ~ \.php$ {
      try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/example.com/public_html$fastcgi_script_name;
    }

}


Could anyone please tell me how the try_files should be? When I attempt to load the website it simply returns 404. I haven't used nginx in a few years thus any help would be kindly appreciated :-)

Cheers


Top
   
PostPosted: Mon Mar 23, 2015 9:35 am 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Helping you while you hide information is going to be like pulling teeth.

What is the domain that is actually experiencing this issue?

- Les


Top
   
PostPosted: Mon Mar 23, 2015 2:25 pm 
Offline
Senior Newbie

Joined: Tue Mar 16, 2010 5:15 am
Posts: 5
Location: Melbourne, Australia
I do not see why you need the domain name - it is a simple wordpress setup and that is the config file as above


Top
   
PostPosted: Mon Mar 23, 2015 3:40 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
You also "don't see why" your site isn't working.

No one likes to play twenty-questions.

Is your website private? No? Then if it's public, what difference does it make if you list it here or not?

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Mon Mar 23, 2015 8:28 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
You just need this inside the "location /" block:
Code:
 location / {
   [...]
    try_files $uri $uri/ /index.php?$args;
  }


Top
   
PostPosted: Tue Mar 24, 2015 1:31 pm 
Offline
Senior Newbie

Joined: Tue Mar 16, 2010 5:15 am
Posts: 5
Location: Melbourne, Australia
vonskippy wrote:
You also "don't see why" your site isn't working.

No one likes to play twenty-questions.

Is your website private? No? Then if it's public, what difference does it make if you list it here or not?


I'm sorry you feel that way.

sanvila wrote:
You just need this inside the "location /" block:
Code:
 location / {
   [...]
    try_files $uri $uri/ /index.php?$args;
  }


Thanks! It worked!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group