Discover Centmin Mod today
Register Now

Install Nginx PHP-FPM Domains Amazon EC2 using internal IP as FTP Host and public IP is inaccessible

Discussion in 'Install & Upgrades or Pre-Install Questions' started by hnit, May 14, 2018.

  1. hnit

    hnit New Member

    22
    4
    3
    Apr 12, 2017
    Ratings:
    +4
    Local Time:
    8:58 PM
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit ?
    • Centmin Mod Version Installed: i.e. 123.08stable
    • Nginx Version Installed: bash: nginx: command not found
    • PHP Version Installed: bash: php: command not found
    • MariaDB MySQL Version Installed: mysql Ver 15.1 Distrib 10.0.35-MariaDB, for Linux (x86_64) using readline 5.1
    • When was last time updated Centmin Mod code base ? : right after reinstall
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:

      cat /etc/centminmod/custom_config.inc


      Code:
      cat: /etc/centminmod/custom_config.inc: No such file or directory

    Hi, so it's a fresh install on Amazon's EC2 and I use the one-liner for the stable branch.

    I made sure that port 443 and 80 are allowed.
    Port 22 is allowed from Jumphost
    and 21 is from my workplace's IP

    I also have a single partition of 30GB and I'm using t2.medium. This is what the tech team in my company gave it to me.

    The problem is. I see the FTP Hostname after creating the domain is set to internal IP and I cannot access anything by using public IP.

    I don't want to run centmin.sh option 21 just yet before confirming because in a corporate environment I won't be getting another chance again.

    -----------

    After the install I run centmin command and I added a wordpress vhost using option 22.
    It seems that the files are missing too

    Code:
    [[email protected] public]# ls
    403.html  404.html  500.html  502.html  503.html  504.html  50x.html  maintenance.html  wp-content
    I'm lost again
     
    Last edited: May 14, 2018
  2. hnit

    hnit New Member

    22
    4
    3
    Apr 12, 2017
    Ratings:
    +4
    Local Time:
    8:58 PM
    Update: After reading PHP-FPM - PHP: Command not found
    it seems like I need to now upgrade to beta branch?
    I entered root mode using the sudo su after logging in

    Update 2: I get that one time task everytime I run 'centmin'

    Code:
    /etc/init.d /usr/local/src/centminmod
    /usr/local/src/centminmod
    
    update wget to 1.19.2 version... one time task
    Total wget Install Time: .010146510 seconds
     
    Last edited: May 14, 2018
  3. hnit

    hnit New Member

    22
    4
    3
    Apr 12, 2017
    Ratings:
    +4
    Local Time:
    8:58 PM
    Update3: service php-fpm restart

    Code:
    [[email protected] ~]# service php-fpm restart
    Gracefully shutting down php-fpm  done
    Starting php-fpm  done
    service nginx restart

    Code:
    [[email protected] ~]# service nginx restart
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
                                                               [FAILED]
    systemctl status nginx.service

    Code:
    [[email protected] ~]# systemctl status nginx.service
    ‚óŹ nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
       Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since Mon 2018-05-14 10:52:32 UTC; 35s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 944 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=1/FAILURE)
    
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal nginx[944]: Starting nginx: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal systemd[1]: nginx.service: control process exited, code=exited status=1
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal nginx[944]: [FAILED]
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal systemd[1]: Unit nginx.service entered failed state.
    May 14 10:52:32 ip-xxxxx.ap-southeast-1.compute.internal systemd[1]: nginx.service failed.
    --------

    which php

    Code:
    [[email protected] ~]# which php
    /usr/bin/which: no php in (/usr/lib64/ccache:/sbin:/bin:/usr/sbin:/usr/bin)
    whereis php

    Code:
    [[email protected] ~]# whereis php
    php: /usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini /usr/local/php
    which nginx

    Code:
    [[email protected] ~]# which nginx
    /usr/bin/which: no nginx in (/usr/lib64/ccache:/sbin:/bin:/usr/sbin:/usr/bin)
    whereis nginx

    Code:
    [[email protected] ~]# whereis nginx
    nginx: /usr/local/sbin/nginx /usr/local/nginx
     
  4. hnit

    hnit New Member

    22
    4
    3
    Apr 12, 2017
    Ratings:
    +4
    Local Time:
    8:58 PM
    I don't know if I should first

    21). Update - Nginx + PHP-FPM + Siege

    and then 23). Update Centmin Mod Code Base

    or vice versa
     
  5. eva2000

    eva2000 Administrator Staff Member

    35,559
    7,841
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,085
    Local Time:
    1:28 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Yes current Centmin Mod stable or beta has never been tested with Amazon EC2 servers so there's no guarantee that it will work. Easiest thing to do is use a different web host. A few reasons why are below:

    1. Centmin Mod 123.08stable does not work with sudo user as it assumes install is done as full root user which is wasn't sudo elevated. If you initially installed with 123.08stable, it definitely won't work. So operating system reinstall is best. Centmin Mod 123.09beta01 may have a higher chance of working but still the there are below outlined reasons why that it may not work out of the box.

    2. Centmin Mod 123.09beta01 and higher may not 100% work with sudo user for initial install though it does have some code updates for such support. 123.09beta01 also supports sudo user creation after initial install but all centmin.sh related functions still assume full root user ran only. Centmin Mod 123.09beta01 and higher have a tools/addsudousers.sh script created to properly setup sudo users for elevation to root user. You can add a new sudo user i.e. george via below commands after initial install.
    Code (Text):
    cd /usr/local/src/centminmod/tools
    ./addsudousers.sh george
    


    3. Out of box Amazon EC2 has it's own firewall via EC2 Security Groups Authorizing Inbound Traffic for Your Linux Instances - Amazon Elastic Compute Cloud. So you won't be able to connect to your EC2 server via SSH, HTTP or HTTPS unless properly configure the firewall. So you have to configure to allow port 21, 22, 80 and 443 as well as passive IP port range for pure-ftpd etc. Pure-ftpd passive port IP range is outlined here on official FTP page as 3000 to 3050 for Centmin Mod 123.08stable or 30001 to 50011 for Centmin Mod 123.09 beta and higher. Also need 9418 port for git. A full port list is available at CSF - Centmin Mod LEMP stack CSF Firewall default port listing

    So you need to be familiar with setting up EC2 yourself first. If unfamiliar need to read their documentation otherwise use a different web host.

    Unfortunately, right now unless you can figure it out yourself, Amazon EC2 isn't really supported or tested server environment for current Centmin Mod versions.

    Your ftp connection issues might be due to missing whitelisting the FTP passive port ranges on EC2 firewall. But your service issues probably due to 123.08stable initial install not supporting sudo users.
     
..