Web Hosting
Admin Control Panel Setup Guide (nginx on linux)
This guide will help you set up the Admin Control Panel on a Linux server using NGINX and PHP-FPM.
Important: This setup guide is specifically for NGINX on Linux systems. We only provide support for NGINX configurations and advise against using Windows Server with Apache due to performance limitations.
Prerequisites
A Linux server (Ubuntu 20.04 or newer recommended)
Root or sudo access to the server
Basic command line access (SSH or direct terminal)
Step 1: Update Your System
First, let's make sure your system is up to date. Open your terminal and run:
sudo apt update
sudo apt upgrade -y
Step 2: Install Required Software
Install NGINX, PHP-FPM, and other necessary components:
sudo apt install nginx php8.1-fpm php8.1-mysql php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-zip unzip -y
Step 3: Start and Enable Services
Make sure NGINX and PHP-FPM start automatically when your server boots:
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start php8.1-fpm
sudo systemctl enable php8.1-fpm
Step 4: Upload Your Admin Control Panel Files
Upload your Admin Control Panel files to the web directory. You can use SCP, SFTP, or any file transfer method you prefer.
Place all your files in the /var/www/
directory:
# Create the directory if it doesn't exist
sudo mkdir -p /var/www/yourdomain.com
# If you're uploading via command line, example:
# sudo cp -r /path/to/your/admin-panel-files/* /var/www/yourdomain.com/
Step 5: Set Correct Permissions
Set the proper ownership and permissions for your files:
# Change ownership to the web server user
sudo chown -R www-data:www-data /var/www/yourdomain.com
# Set file permissions
sudo chmod -R 750 /var/www/yourdomain.com
Step 6: Configure NGINX
Create a new NGINX configuration file for your Admin Control Panel:
sudo nano /etc/nginx/sites-available/yourdomain.com
Add the following configuration (replace your-domain.com
with your actual domain):
server {
listen 80;
listen [::]:80;
server_name yourdomain.com;
set $base /var/www/yourdomain.com;
root $base/;
# security
include nginxconfig.io/security.conf;
# logging
access_log /var/log/nginx/access.log combined buffer=512k flush=1m;
error_log /var/log/nginx/error.log warn;
# index.php
index index.php;
# index.php fallback
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# static files
location ~* \.(css|js|jpg|jpeg|png|gif|ico|woff2|woff|ttf|svg|eot)$ {
root $base;
expires 30d;
add_header Cache-Control "public, no-transform";
try_files $uri =404;
}
# handle .php and extensionless PHP files
location ~ ^/(.+?)(/.*)?$ {
try_files $uri $uri.php $uri/ /index.php?$query_string;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm-yourdomain.com.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# explicit .php files
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm-yourdomain.com.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# additional config
include nginxconfig.io/general.conf;
}
Step 7: Enable Your Site
Enable your new site configuration and disable the default NGINX site:
# Enable your site
sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
Step 8: Test and Reload NGINX
Test your NGINX configuration for syntax errors:
sudo nginx -t
If the test passes, reload NGINX to apply the changes:
sudo systemctl reload nginx
Step 9: Access Your Admin Control Panel
You should now be able to access your Admin Control Panel by visiting:
http://your-domain.com
(or your server's IP address)
Troubleshooting
Common Issues
NGINX won't start:
# Run nginx's built in site config tester and resolve errors.
nginx -t
PHP files downloading instead of executing:
Check that PHP-FPM is running:
sudo systemctl status php8.1-fpm
Verify your NGINX configuration includes the PHP location block
Permission denied errors:
sudo chown -R www-data:www-data /var/www/yourdomain.com
sudo chmod -R 755 /var/www/yourdomain.com
Check error logs:
sudo tail -f /var/log/nginx/error.log
Next Steps: SSL Setup
For production use, you'll want to secure your Admin Control Panel with SSL. Here are helpful resources:
Let's Encrypt (Free SSL): https://certbot.eff.org/
NGINX SSL Configuration: https://nginx.org/en/docs/http/configuring_https_servers.html
Support: If you encounter issues during setup, please join our Discord community at https://discord.ivs.dev for assistance.
Last updated