Tagged: codeigniter, coolify, self managed hosting course
-
Upload the source code of my CodeIgniter website on Coolify
Posted by Tejas Gandhi on August 22, 2025 at 5:46 amDear Hasan sir
How I install my CodeIgniter website code on the server with coolify? Please guideHasan replied 2 weeks ago 3 Members · 3 Replies -
3 Replies
-
You can push your code to a Git repo, then create a new application in Coolify and connect that repo. Add a Dockerfile (or docker-compose) in your project that sets up PHP and the web server, add your secrets keys in the environment variables, and deploy.
Here is an example of deploying an application on coolify using your own Docker Regisrty: https://selfhostschool.com/docker-tutorial-for-solopreneurs/
-
CodeIgniter is PHP based.
if you are familiar with docker, create a docker file (nginx + php-fpm)
and you can create the MySQL instance separately with coolify as it has built in 1 installer.
as @husein mentioned.
you can push the project to Github, create the docker.yml file, and then in coolify you can connect your repo and deploy using the docker file.
the docker file will look something like:
version: "3.9"
services:
app:
image: php:8.2-fpm-alpine
container_name: ci-php
working_dir: /var/www
volumes:
- ./:/var/www
environment:
PHP_MEMORY_LIMIT: 256M
command: sh -lc "
apk add --no-cache $PHPIZE_DEPS libpng-dev libjpeg-turbo-dev libzip-dev icu-dev oniguruma-dev \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install pdo pdo_mysql gd zip intl mbstring \
&& if [ -f composer.json ]; then \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --no-dev --prefer-dist --no-interaction; \
fi \
&& php-fpm -F
"
web:
image: nginx:alpine
container_name: ci-nginx
depends_on:
- app
ports:
- "8080:80"
volumes:
- ./:/var/www
- ./deploy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
# For production, prefer a managed DB in Coolify (see Step 2).
# This local DB is convenient for quick starts/testing.
db:
image: mysql:8.0
container_name: ci-mysql
environment:
MYSQL_DATABASE: ${DB_NAME:-app}
MYSQL_USER: ${DB_USER:-app}
MYSQL_PASSWORD: ${DB_PASS:-secret}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS:-rootsecret}
volumes:
- dbdata:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password
volumes:
dbdata: -
Or you can can build your Docker Image locally and push to the registry and deploy easily in coolify as we showed in the course with FastAPI Projects.
the DockerFile will something like:
FROM php:8.2-fpm-alpine as phpbase
WORKDIR /var/www
# Install extensions
RUN apk add --no-cache $PHPIZE_DEPS libpng-dev libjpeg-turbo-dev libzip-dev icu-dev oniguruma-dev \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install pdo pdo_mysql gd zip intl mbstring
# Composer (if you use it)
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Copy app files
COPY . /var/www
# Install deps (if composer.json exists)
RUN if [ -f composer.json ]; then composer install --no-dev --prefer-dist --no-interaction; fi
# -------------------------
FROM nginx:alpine
WORKDIR /var/www
# Copy code
COPY . /var/www
# Nginx config (CI4 public/ root assumed)
COPY deploy/nginx/default.conf /etc/nginx/conf.d/default.conf
# PHP-FPM sidecar inside same container (using s6-overlay-like approach is ideal,
# but for simplicity we'll run php-fpm in background via dumb-init).
# Install php-fpm runtime:
RUN apk add --no-cache php82-fpm php82-mysqli php82-intl php82-gd php82-zip php82-mbstring php82-session \
&& sed -i 's|^;cgi.fix_pathinfo=.*|cgi.fix_pathinfo=0|' /etc/php82/php.ini
# Entrypoint: start php-fpm then nginx (simple supervisor-less approach)
CMD sh -lc "php-fpm82 -F & nginx -g 'daemon off;'"
Log in to reply.