Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 4 on VestaCP
#1

Hi everyone!

I use VestaCP to serve my websites. I'm using nginx and php-fpm using socket. Anyway when you use CI3 template, your CI4 project won't work.

To solve this problem copy your CI3 project templates and change uri location.

I use Centos7;

1-) Go to templates location

Code:
cd /usr/local/vesta/data/templates/web/nginx/php-fpm

2-) copy codeigniter3.tpl and codeigniter4.stpl

Code:
cp codeigniter3.tpl codeigniter4.tpl
cp codeigniter3.stpl codeigniter4.stpl

3-) Edit ci 4 templates like that;

codeigniter4.tpl and codeigniter4.stpl

Code:
server {
    listen    %ip%:%web_port%;
    server_name %domain_idn% %alias_idn%;
    root        %docroot%;
    index    index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    location / {
        try_files $uri $uri/ /public/index.php;

and find the htaccess|httpasswd in the same file;

PHP Code:
    location ~* "/\.(htaccess|htpasswd|env)$" {
        deny    all;
        return  404

We added env after htpasswd. Because dotenv file shouldn't be downloadable.

4-) Rebuild your web

[Image: Screenshot-from-2020-10-17-21-12-55.png]

5-) Change your template in your project

[Image: Screenshot-from-2020-10-17-21-14-35.png]

That's all. I hope this will help you.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB