Last active
February 18, 2026 21:05
-
-
Save eSkiSo/68151bb68c0605f7955b3282eb56bb43 to your computer and use it in GitHub Desktop.
Angie (nginx fork) config for subfolder Codeigniter apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| listen 443 ssl; | |
| server_name SERVER_NAME_HERE; | |
| # Certificates, if you comment this also comment "listen 443 ssl" above | |
| ssl_certificate /home/eskiso/myAwesomeServer.cer; | |
| ssl_certificate_key /home/eskiso/myAwesomeServer.pvk; | |
| # root web folder | |
| root /var/www/html; | |
| index index.php index.html; | |
| # Default site | |
| location / { | |
| try_files $uri $uri/ =404; | |
| } | |
| # ===== APPS (CodeIgniter 4) ===== | |
| # Define "downloads" folder, these files will be served by angie | |
| location ^~ /apps/uploads/ { | |
| alias /var/www/html/apps/public/uploads/; | |
| try_files $uri =404; | |
| } | |
| location /apps/ { | |
| rewrite ^/apps/(.*)$ /apps/public/$1 break; | |
| try_files $uri $uri/ /apps/public/index.php$is_args$args; | |
| } | |
| # php config | |
| location ~ ^/apps/public/.*\.php$ { | |
| fastcgi_pass unix:/run/php/php8.4-fpm.sock; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| # ===== APP2 (same structure assumed) ===== | |
| # Define "downloads" folder, these files will be served by angie | |
| location ^~ /app2/uploads/ { | |
| alias /var/www/html/app2/public/uploads/; | |
| try_files $uri =404; | |
| } | |
| location /app2/ { | |
| rewrite ^/app2/(.*)$ /app2/public/$1 break; | |
| try_files $uri $uri/ /app2/public/index.php$is_args$args; | |
| } | |
| location ~ ^/app2/public/.*\.php$ { | |
| fastcgi_pass unix:/run/php/php8.4-fpm.sock; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| # Global PHP fallback (optional safety) | |
| location ~ \.php$ { | |
| fastcgi_pass unix:/run/php/php8.4-fpm.sock; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment