Skip to main content
Create a new site configuration:
sudo nano /etc/nginx/sites-available/startmyvpn
server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/startmyvpn/public;
    index index.php;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_hide_header X-Powered-By;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

    client_max_body_size 50M;
}
Enable and reload:
sudo ln -s /etc/nginx/sites-available/startmyvpn /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

SSL with Let’s Encrypt

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot automatically modifies the Nginx config and sets up auto-renewal.

Apache

Enable required modules:
sudo a2enmod rewrite headers
Create a virtual host:
<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/startmyvpn/public

    <Directory /var/www/startmyvpn/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/startmyvpn-error.log
    CustomLog ${APACHE_LOG_DIR}/startmyvpn-access.log combined
</VirtualHost>
The included .htaccess in /public handles URL rewriting automatically.