Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

how to install nginx ?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Locked
  • Print view
Advanced search
5 posts • Page 1 of 1
balinese
Posts: 13
Joined: Thu Nov 26, 2015 9:36 am

how to install nginx ?

Post by balinese » Thu Jan 21, 2016 5:52 am

Hi, i iinstalled vesta completelly without nginx, only apache. now i need to add nginx as a proxy for apache, how can i do that?
system is centos 6.7
Top

tjebbeke
Collaborator
Posts: 783
Joined: Mon May 11, 2015 8:43 am
Contact:
Contact tjebbeke
Website

Os: CentOS 6x
Web: apache + nginx
Re: how to install nginx ?

Post by tjebbeke » Thu Jan 21, 2016 10:12 am

The fastest way is to take a backup of your users, reinstall your server with Nginx enabled and restore all backups.
You can also try to install Nginx manually you can use the installation script to change the right configuration.
Top

Elizine
Posts: 50
Joined: Wed Aug 12, 2015 12:11 pm
Contact:
Contact Elizine
Website

Re: how to install nginx ?

Post by Elizine » Fri Jan 29, 2016 3:57 am

Edit the file

Code: Select all

/etc/php-fpm.d/www.con
and change user and group from apache to nginx. It should look similar to the block below.

Code: Select all

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
Now we need to make some changes to the Nginx configuration file so that php-fpm works correctly with Nginx. Using your favorite editor, edit the file /etc/nginx/conf.d/default.conf and carry out the following changes or copy the following block below into your conf file.

1) Add the index.php to the index location

2) Change the root location to /usr/share/nginx/html

3) Uncomment the Pass PHP scripts to FastCGI section.

4) Change the fastcgi_param SCRIPT_FILENAME to use /usr/share/nginx/html$fastcgi_script_name

Code: Select all

#
# The default server
#
server {
    listen       80 default_server;
    server_name  _;
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

Create a test PHP file in the following directory with the following command:

Code: Select all

sudo vi <tt>/usr/share/nginx/html/info.php</tt>
Insert the following code in the space then save and exit:

Code: Select all

<?php
phpinfo();
?>
Restart apache so all the changes take effect:

Code: Select all

sudo service nginx restart
Top

DESSAR_SEGA
Posts: 16
Joined: Sun Oct 02, 2016 10:48 am
Contact:
Contact DESSAR_SEGA
Website

Os: Ubuntu 15x
Web: apache + nginx
Re: how to install nginx ?

Post by DESSAR_SEGA » Sat Dec 10, 2016 7:59 pm

Is the same guide for ubuntu?
Ubuntu 14.04
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: how to install nginx ?

Post by skurudo » Thu Mar 02, 2017 8:30 pm

Yep, but I like to take viewtopic.php?f=11&t=10368#p38024 offer an re-install.
Top


Locked
  • Print view

5 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password