Join the community today
Register Now

Install Apache and run Nginx as a reverse proxy

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Alcides, Nov 1, 2017.

  1. Alcides

    Alcides New Member

    7
    1
    3
    Aug 18, 2017
    Ratings:
    +1
    Local Time:
    7:54 PM
    Hello!

    I am preparing a production server with the 123.09beta01
    I would like to use NGINX as a main webserver but for some applications I would like to use Apache behind and run Nginx as a reverse proxy due to the complex rewrite/httacess setup.

    The methody I am using to install/setup Apache on 123.09beta01 CentOS 7 box is following:
    --------------------------------------------------
    ### --- Preparing Installation --- ###
    How to Install The Latest Apache Server (httpd) on Centos 7 | CROSP's Blog
    sudo yum install -y epel-release
    cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo
    -------------------------------------------------
    ### --- Edit Repository config file --- ###
    vim /etc/yum.repos.d/codeit.el7.repo
    Add a line at the end with: priority=1
    -------------------------------------------------
    ### --- Installation --- ###
    yum install httpd
    systemctl start httpd
    systemctl enable httpd
    --------------------------------------------------
    ### --- Change TCP Listen port --- ###
    vim /etc/httpd/conf/httpd.conf
    Change Listen port to 80 to 8080
    --------------------------------------------------
    ### --- Add Firewall Ruresl --- ###
    vim /etc/csf/csf.conf
    Add port 8080 for TCP ipv6 and ipv4.
    csf -r (restart)
    --------------------------------------------------
    ### --- Enable Apache Modules for Proxy --- ###
    Create a custom config file
    touch /etc/httpd/conf.modules.d/custommodules.conf
    Add the lines bellow:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
    --------------------------------------------------
    ### --- Setup apache vistual host to use PHP-FPM --- ###
    --------------------------------------------------
    Add inside of the vistual host directive:
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1
    DirectoryIndex /index.php index.php
    --------------------------------------------------

    I have done this. Looks like it is working very well. BUT I am not sure If I can couse future issues with Centminmod.

    Could you please tell me what is the best practices do you recommend to install apache without produce any issue with centnmod scripts and repositories dependences?
    I would like to keep updating Centinmod and I would like to avoid any future possible issue.

    Thanks in advanced.
     
  2. Jimmy

    Jimmy Premium Member Premium Member

    1,147
    253
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +616
    Local Time:
    4:54 PM
    1.13.x
    MariaDB 10.1.x
    [​IMG]
     
  3. Alcides

    Alcides New Member

    7
    1
    3
    Aug 18, 2017
    Ratings:
    +1
    Local Time:
    7:54 PM
    ?
     
  4. pamamolf

    pamamolf Well-Known Member

    2,778
    245
    63
    May 31, 2014
    Ratings:
    +437
    Local Time:
    11:54 PM
    Nginx-1.13.x
    MariaDB 10.1.x
  5. eva2000

    eva2000 Administrator Staff Member

    30,631
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    7:54 AM
    Nginx 1.13.x
    MariaDB 5.5