Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 12th February 2012, 17:24
nikal nikal is offline
Junior Member
 
Join Date: Feb 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ubuntu 11.10 & nginx configuration

Hello , noob here!

I am setting up my first server folowing this 2 howto's first and second

i do own a domain name (who serves my wordpress in an ISP)and i want my brand new nginx server (an old pc somewhere in my home) as a owncloud service .

I went to my domains cp and add a new DNS record , let's say server.mydomain.com with the right static ip of my router .
then i open the right ports to the router 80&22 (ssh)
and finished my owncloud setup like here

But im getting a 502 bad gateway error
My problem I quess is in my vhost configuration (noob here )
because i use a subdomain !
I try some configurations but i have to admit i don't understund them!
for examble i use

server {
listen server.mydomain.com;
server_name server.mydomain.com;
root /var/www/server.mydomain.com/web;

if ($http_host != "server.mydomain.com") {
rewrite ^ http://server.mydomain.com$request_uri permanent;
}

configuration and i get "Welcome to nginx!" and the info.php works under server.mydomain.com/info.php but the owncloud instalation not!
when i change the listen to 80 i get 502 bad gateway

can someone point me (or better show me) the right configuration?

Thanks
Reply With Quote
Sponsored Links
  #2  
Old 13th February 2012, 12:25
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Please restart PHP-FPM:

Code:
/etc/init.d/php5-fpm restart
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 13th February 2012, 12:36
nikal nikal is offline
Junior Member
 
Join Date: Feb 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
Please restart PHP-FPM:

Code:
/etc/init.d/php5-fpm restart
Thank you Falco for your answer but i all ready did that every time i change my vhost configuration .Also reload nginx , clear browser cache but the resault is the same .

I try all the possible configuration i find on nginx foroum and wiki but nothing seems to work for me .

I am pretty sure i miss something in that vhost but as I say i am new in all that stuff so the 3 day heading is normal for a newbee like me
Reply With Quote
  #4  
Old 14th February 2012, 13:57
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Can you post your vhost configuration and the output of
Code:
netstat -tapn
?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 14th February 2012, 18:31
nikal nikal is offline
Junior Member
 
Join Date: Feb 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello again Falco and thank you for your reply!

The netstat -ntap
Code:
tcp		0	0	127.0.0.1:3306	0.0.0.0:*	LISTEN		667/mysqld
tcp		0	0	0.0.0.0:80	0.0.0.0:*	LISTEN		717/nginx
tcp		0	0	0.0.0.0:22	0.0.0.0:*	LISTEN		447/sshd
tcp		0	0	0.0.0.0:25	0.0.0.0:*	LISTEN		847/master
tcp6		0	0	:::22		:::*		LISTEN		447/sshd
and the vhost config
Code:
server {
       listen 80;
       server_name server.mydomain.com;
       root /var/www/server.mydomain.com/web;

       if ($http_host != "server.mydomain.com") {
                 rewrite ^ http://server.mydomain.com$request_uri permanent;
       }

       # This is to avoid a "Request Entity Too Large" error
       client_max_body_size 1000M;
       index index.php index.html index.htm;

       dav_methods PUT DELETE MKCOL COPY MOVE;
       create_full_put_path on;
       dav_access user:rw group:rw all:r;

       location = /favicon.ico {
                log_not_found off;
                access_log off;
                expires max;
       }

       location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
       }

       # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
       location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
       }

       location / {
                index index.php;
                try_files $uri $uri/ @webdav;
       }

       location @webdav {
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
                #fastcgi_param HTTPS on;
                fastcgi_pass 127.0.0.1:9000;
       }

       location ~ \.php$ {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_index index.php;
       }
}
I maybe did something wrong today! I rm the default config under /etc/nginx/sites-available/ and /etc/nginx/sites-enabled/ . Is that bad? and if it is wrong can you paste here the default config so i can make a new file?

Also I notice that there is no php5-cgi pid in my netstat -ntap is that my problem? The php5-fpm don't start?

edit: Now I saw that you wanted netstat -tapn !! sorry!!

the only diference is the

tcp 0 0 127.0.0.1:80 127.0.0.1:51587 TIME_WAIT -

Last edited by nikal; 14th February 2012 at 18:52.
Reply With Quote
  #6  
Old 15th February 2012, 10:07
nikal nikal is offline
Junior Member
 
Join Date: Feb 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again ,

I tried some changes to my vhost based to that my php5-fpm not working

i changed the fastcgi_pass

Quote:
Originally Posted by nikal View Post
.....

Code:
.....

       location ~ \.php$ {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
         this--->       fastcgi_pass 127.0.0.1:9000;
          to ---->      fastcgi_pass unix:/tmp/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_index index.php;
       }
}
.......
But still don't work maybe for that reason?
I maybe did something wrong today! I rm the default config under /etc/nginx/sites-available/ and /etc/nginx/sites-enabled/ . Is that bad? and if it is wrong can you paste here the default config so i can make a new file?

Yes yes I know I'am dummie
Reply With Quote
  #7  
Old 15th February 2012, 12:26
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Quote:
Originally Posted by nikal View Post
Hello again Falco and thank you for your reply!

The netstat -ntap
Code:
tcp		0	0	127.0.0.1:3306	0.0.0.0:*	LISTEN		667/mysqld
tcp		0	0	0.0.0.0:80	0.0.0.0:*	LISTEN		717/nginx
tcp		0	0	0.0.0.0:22	0.0.0.0:*	LISTEN		447/sshd
tcp		0	0	0.0.0.0:25	0.0.0.0:*	LISTEN		847/master
tcp6		0	0	:::22		:::*		LISTEN		447/sshd
There's no PHP-FPM daemon listening on port 9000, so make sure it is running and uses TCP instead of Unix sockets.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu server + java JDK + nginx (as proxy to jetty) + jetty + mysql + memcached bokivaol Suggest HOWTO 0 12th February 2012 16:57
Tutorial: The Perfect Server – Ubuntu 11.10 [ISPConfig 3] pureftpd issue madlars HOWTO-Related Questions 12 19th January 2012 12:20
Install Zoneminder 1.25 source wi Ubuntu Server 11.10 64bit, libjpeg-turbo, Cambozola letsharehowto HOWTO-Related Questions 0 15th November 2011 16:23
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On Ubuntu 10.10 SamTzu HOWTO-Related Questions 5 27th November 2010 21:53
ISPConfig 3 + Ubuntu 9.04 Configuration danielborene General 6 13th June 2009 22:16


All times are GMT +2. The time now is 15:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.