Want more timely Centmin Mod News Updates?
Become a Member

Moving Codeigniter Website ApacheCodeigniter to Nginx

Discussion in 'Other Web Apps usage' started by iqbal pria fadhilah, May 30, 2019.

  1. iqbal pria fadhilah

    iqbal pria fadhilah New Member

    5
    1
    3
    Nov 29, 2018
    Ratings:
    +1
    Local Time:
    3:58 PM
    1.5.7
    10.1.37
    Hi, i'm trying to move Apache Codeigniter website to centminmod Nginx and receive : HTTP ERROR 500

    My migration to subdomain, before it was subfolder



    .htaccess :

    Code (Text):
      RewriteEngine on
      RewriteCond $1 !^(index\.php|resources|robots\.txt)
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /backend/index.php?/$1 [L,QSA]
      AddDefaultCharset utf-8
    


    Try to using default nginx from wordpress and get more information on the web but still stuck at HTTP ERROR 500

    Error Log :

    Code (Text):
    2019/05/29 16:49:52 [warn] 21029#21029: conflicting server name "member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 16:49:52 [warn] 21029#21029: conflicting server name "www.member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 16:52:05 [warn] 21201#21201: conflicting server name "member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 16:52:05 [warn] 21201#21201: conflicting server name "www.member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:13:57 [warn] 26565#26565: conflicting server name "member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:13:57 [warn] 26565#26565: conflicting server name "www.member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:32:48 [warn] 27779#27779: conflicting server name "member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:32:48 [warn] 27779#27779: conflicting server name "www.member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:35:14 [warn] 28010#28010: conflicting server name "member.choirexpress.co.id" on 0.0.0.0:80, ignored
    2019/05/29 18:35:14 [warn] 28010#28010: conflicting server name "www.member.choirexpress.co.id" on 0.0.0.0:80, ignored
    


    How it works in nginx ?

    Regards,

    relevant information :
    • CentOS Version: CentOS 7 64bit ?
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.15.3
    • PHP Version Installed: 7.2.9
    • MariaDB MySQL Version Installed: 10.2.xx
    • When was last time updated Centmin Mod code base ? : cmupdate command
     
    Last edited: May 30, 2019
  2. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:58 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Unfortunately no experience with codeigniter so you'd need to ask on codeigniter community support forums around the internet and google search "Codeigniter nginx site:stackoverflow.com" and examples at Codeigniter | NGINX with some codeigniter config.php changes and for nginx equivalent would be just be this for location context root / if app is installed at /home/nginx/domains/domain.com/public web root for Centmin Mod nginx vhost configs you only need
    Code (Text):
    location / {
      try_files $uri $uri/ /index.php;
    }
    

    if app is installed at /home/nginx/domains/domain.com/public/backend for Centmin Mod nginx vhost configs you only need
    Code (Text):
    location /backend {
      try_files $uri $uri/ /backend/index.php;
    }
    

    no need to reference .php location context as Centmin Mod's default php.conf include covers it I suspect.
     
  3. iqbal pria fadhilah

    iqbal pria fadhilah New Member

    5
    1
    3
    Nov 29, 2018
    Ratings:
    +1
    Local Time:
    3:58 PM
    1.5.7
    10.1.37
    it still error 500, hope someone have the solution.

    trying to download clean codeigniter and its works with default try_files, but when i migrate i have no clue why it still error 500.

    thanks @eva2000
     
  4. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:58 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    what is output of these commands in ssh
    Code (Text):
    curl -I https://domain.com
    

    Code (Text):
    curl -I https://www.domain.com
    

    Code (Text):
    curl -I http://domain.com
    

    Code (Text):
    curl -I http://www.domain.com
    

    wrap output in CODE tags