• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
codeigniter4 with nginx ssl not work

#1
I use the nginx config in codeigniter3,it works。

but in codeigniter4 not work



Code:
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.domain.com domain.com *.domain.com;
        return 301 https://www.domain.com$request_uri;
    }

server
    {
        listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        server_name www.domain.com domain.com *.domain.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root /home/wwwroot/ci400rc21/public;
        #ssl on;
        ssl_certificate /etc/letsencrypt/live/www.domain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/www.domain.com/privkey.pem;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

        include enable-php.conf;

        location / {
        try_files $uri $uri/ /index.php/$args;
    }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/www.domain.com.log;
    }



return 500 error



when not use ssl,
Code:
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.domain.com domain.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root /home/wwwroot/ci400rc21/public;
        
        location / {
                try_files $uri $uri/ /index.php/$args;
        }
        #error_page   404   /404.html;
        location ~ [^/]\.php(/|$)
            {
                try_files $uri =404;
                fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
            }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }

        location ~ .*\.(js|css)?$
            {
                expires      12h;
            }

        access_log  /home/wwwlogs/www.domain.com.log  access;
    }

also return error

I changed permissions but didn't solve the problem
Code:
chown -R www:www /home/wwwroot/ci400rc21

The logs:
Code:
2019/10/12 14:47:59 [crit] 11053#0: *29 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: *.*.*.*, server: www.domain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "www.domain.com"
Reply

#2
Check server logs. What's the error it's returning?
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#3
(10-10-2019, 08:02 PM)kilishan Wrote: Check server logs. What's the error it's returning?

The logs:
Code:
2019/10/12 14:47:59 [crit] 11053#0: *29 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: *.*.*.*, server: www.domain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "www.domain.com"
Reply

#4
(10-12-2019, 12:14 AM)JerryCode Wrote:
(10-10-2019, 08:02 PM)kilishan Wrote: Check server logs. What's the error it's returning?

The logs:
Code:
2019/10/12 14:47:59 [crit] 11053#0: *29 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: *.*.*.*, server: www.domain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "www.domain.com"
repair your nginx configuration. Your probem not related to Codeigniter.You must verivy location/path of php-fpm.sock file
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.