Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End NGINX configuration

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #185221
    chrisburton
    Participant

    @traq Perhaps you know what I’m doing wrong here. Let me give you the steps I took.

    • Installed Nginx on my VPS (Centos 6)
    • Quit Apache to avoid conflict of Nginx running on port 80
    • Started up Nginx

    I checked my website (domain.com) and I received a 404 error.

    • Edited nginx.conf (location portion) to index index.html index.htm index.php; to allow php scripts to be executed
    • Edited default.conf (server portion) to reflect the location of my public html folder

    Checked website again and still get a 404 error but this time my index.php file was trying to download. To avoid vulnerabilities (database stuff) from being seen, I took it down.

    Could you help me to configure Nginx for Centos 6? The following are my config files:

    nginx.conf
    default.conf

    #185232
    Alen
    Participant

    You need to pass on the request to the socket. I’m on mobile now, but something like

    
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    
                # With php5-cgi alone:
                # fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
    
    #185235
    nixnerd
    Participant

    See @chrisburton? That block you had commented out is what is needed. Pretty sure php-fpm is a package you’ll have to install separately though. It’s been a minute since I configured mine. Digital Ocean has great tuts and they should be no different on any other VPS provider for the most part.

    #185236
    chrisburton
    Participant

    Thanks, Alen!


    @joe_temp
    Yeah, I tried installing php-fpm but keep getting conflicts. I’ll try to figure it out.

    #185249
    nixnerd
    Participant

    Hmmm. Feel free to post the conflicts you’re getting if you get stuck. That way, we can help out as we can.

    Sorry this is such a pain. I found the Nginx setup to be much easier than Apache.

    #185250
    chrisburton
    Participant

    I really screwed things up with the command line so I have to start over.

    #185254
    __
    Participant

    Are you following any particular guide? This one looks pretty nice.

    #185256
    chrisburton
    Participant

    @traq I’m going with Ubuntu this time around. They have better and more tutorials. I really want to use HHVM but haven’t found a suitable tutorial to follow for Centos 6.

    #185258
    __
    Participant

    the guide I linked to has an Ubuntu version. basically the same, but with apt-get instead of yum.

    #185267
    Alen
    Participant

    I learned so much about provisioning by visiting Vaprobash on GitHub and looking at various install scripts. Visit servers for hackers as well. Lots of good info.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Back End’ is closed to new topics and replies.