Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Feb 05, 2011 2:17 am 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
I did a search but never seemed to find the issue/guidance for my question.

I followed the installation of nginx with Ubuntu 10.10 here on the library. I installed PHP and MySQL following this guide too (LEMP stack).

Now, for additional convenience, I wanted to also setup phpMyAdmin.

I've done everything I need to except create a VirtualHost entry.

I want it to be: http://domain.com/phpmyadmin.

Here is my /etc/nginx/sites-available/domain.com file contents:

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

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

     location /phpmyadmin {
          root /usr/share/phpmyadmin;
          index index.php;
     }

      location ~ \.php$ {
           include fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name;
       }
}


The second "location" entry is me testing. I'm probably missing something simple. Not sure!

Any help is greatly appreciated! Thanks!


Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 11:14 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
OK so what is your problem exactly? Maybe it's because I've not woken up yet but I don't see what issue you're having...

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 12:25 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Oh... d'oh!

If I go to http://domain.com/phpmyadmin I get 404'd.

Edit: Hmm... nevermind now it's not even recognizing nginx at all (Server not found).

Edit2: Ok nevermind it's working again. The index.html is working and I've tested a phpinfo() as well. But still having that 404 issue.

Edit3: Ugh... weird issue now. index.html works fine but if I F5 (refresh) I get a Server not found. But if I click the address bar and hit Enter (basically another way to refresh) it works fine!???


Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 12:51 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
It's probably due to this part

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name;
}

The index.php file for phpmyadmin is being passed to /srv/www/domain.com/public_html with $fastcgi_script_name being /phpmyadmin/index.php

You need to set it up so it sends to /usr/share/phpmyadmin$fastcgi_script_name

Try this

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

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

     location ^~ /phpmyadmin/ {
          root /usr/share/phpmyadmin;
          index index.php;
     include fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /usr/share/$fastcgi_script_name;
     }

      location ~ \.php$ {
           include fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name;
       }
}

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 1:00 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Thanks.

I've adjust accordingly, but continue to have this "F5 / www. issue. And the /phpmyadmin is Server not found no matter what I try.

Maybe I configured the DNS Manager wrong?

I simply did "ns1.domain.com" for the web address and then in my GoDaddy account "ns1.linode.com" and "ns2.linode.com"

EDIT: Woot! I fixed it :) I had a stupid DNS issue. My bad :) All is working now with the configuration you gave me as well!

Thanks!!


Last edited by delibar on Sat Feb 05, 2011 3:05 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 3:05 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
I'll need your linode IP and real domain to diagnose DNS issues.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sat Feb 05, 2011 3:05 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Fixed :)

I simply changed it back to domain.com (which is what I though it should've been) and now all is working.


Top
   
 Post subject:
PostPosted: Fri Feb 11, 2011 2:19 am 
Offline
Newbie

Joined: Tue Feb 23, 2010 12:34 am
Posts: 3
Website: http://kromey.us
You should be able to ditch that redundant PHP FastCGI within your phpmyadmin location by changing your .php location to:
Code:
location ~ \.php$ { 
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}


Note the changed SCRIPT_FILENAME line -- by using the variable $document_root you can avoid redundant hard-codings of your root path, and only write it once. Also, it should mean that alternative root paths -- such as that within your phpmyadmin location -- will automatically "fix" the SCRIPT_FILENAME path for you.

Also, the use of $document_root instead of a redundant hard-coded path is the preferred way, and using it will save you much ridicule from the Nginx community. :wink:

EDIT: I should clarify that I've not tested this solution myself, but it seems like it should work. At any rate, do switch to using $document_root, if nothing else it'll save you some grief when you forget you've got a second hard-coded path down the road when you're moving things around! :wink:


Top
   
 Post subject:
PostPosted: Fri Feb 11, 2011 4:00 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Kromey wrote:
You should be able to ditch that redundant PHP FastCGI within your phpmyadmin location by changing your .php location to:
Code:
location ~ \.php$ { 
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}


Note the changed SCRIPT_FILENAME line -- by using the variable $document_root you can avoid redundant hard-codings of your root path, and only write it once. Also, it should mean that alternative root paths -- such as that within your phpmyadmin location -- will automatically "fix" the SCRIPT_FILENAME path for you.

Also, the use of $document_root instead of a redundant hard-coded path is the preferred way, and using it will save you much ridicule from the Nginx community. :wink:

EDIT: I should clarify that I've not tested this solution myself, but it seems like it should work. At any rate, do switch to using $document_root, if nothing else it'll save you some grief when you forget you've got a second hard-coded path down the road when you're moving things around! :wink:


I appreciate your help, Kromey!

Unfortunately, I was not able to get this working with that change.

What could possibly be the issue?

Thanks!

EDIT: Actually, I see the reason why. /phpmyadmin is located in an area that is NOT the server directory. In this case, I believe hard-coding that in is the only way. Unless I am mistaken. For most PHP applications, I should be perfect though, because I will simply be utilizing the server directory.


Top
   
 Post subject:
PostPosted: Fri Feb 11, 2011 4:55 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Hmm... I just recently restarted my server and am now receiving "502 Bad Gateway" when accessing www.domain.com/phpmyadmin

Here is my current file contents:
Code:
server {
    listen   80;
    server_name www.domain.com domain.com;
    access_log /srv/www/domain.com/logs/access.log;
    error_log /srv/www/domain.com/logs/error.log;

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

 location ^~ /phpmyadmin/ {
          root /usr/share/phpmyadmin;
          index index.php;
           include fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
     }
 location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name;
    }
}


Top
   
 Post subject:
PostPosted: Fri Feb 18, 2011 8:59 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
I'm still having this issue :*(


Top
   
 Post subject:
PostPosted: Wed Feb 23, 2011 2:07 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
delibar wrote:
Hmm... I just recently restarted my server and am now receiving "502 Bad Gateway" when accessing www.domain.com/phpmyadmin

Here is my current file contents:
Code:
server {
    listen   80;
    server_name www.domain.com domain.com;
    access_log /srv/www/domain.com/logs/access.log;
    error_log /srv/www/domain.com/logs/error.log;

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

 location ^~ /phpmyadmin/ {
          root /usr/share/phpmyadmin;
          index index.php;
           include fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
     }
 location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name;
    }
}


Thoughts?


Top
   
 Post subject:
PostPosted: Wed Feb 23, 2011 2:41 pm 
Offline
Senior Member

Joined: Mon Aug 31, 2009 2:33 pm
Posts: 78
Location: The OC
I think the line that reads:

fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;

should be:

fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;


Top
   
 Post subject:
PostPosted: Wed Feb 23, 2011 3:38 pm 
Offline
Senior Newbie

Joined: Sat Feb 05, 2011 2:08 am
Posts: 16
Gah! Okay. Well I sat down and played around with this for a while now and finally figured it out.

I had some issue with FastCGI user so I just manually set the user it runs on.

Then I had to adjust the Virtual Host files back to what obs originally provided.

Thanks for the help!


Top
   
 Post subject:
PostPosted: Mon Feb 28, 2011 6:33 pm 
Offline
Senior Newbie

Joined: Sat Feb 26, 2011 10:51 pm
Posts: 15
A couple a days ago I was struggling to access to phpmyadmin (or any "webapp" for this matter) in my arch linux machine, after trying a lot of configurations I found that the simpler approach is to make sure php it's working under any configuration and then make a symbolic link under that directory. In my case was:

/home/user/websites/$ ln -s /usr/share/webapps/phpMyAdmin phpmyadmin

And that's all :P


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


Who is online

Users browsing this forum: No registered users and 0 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