Nginx Subdomain - torarnehave1/slowyouio GitHub Wiki
Setting up maiken.slowyou.io on Ubuntu with Nginx and PHP 8.1
This guide explains how to set up the maiken.slowyou.io
site on an Ubuntu Linux server with Nginx and PHP 8.1, including HTTPS support using Certbot.
Prerequisites
- Ubuntu Linux server
- Nginx web server
- PHP 8.1
- Certbot (for SSL/HTTPS)
Step-by-step Instructions
-
Create the website directory:
sudo mkdir -p /var/www/html/slowyouio/maiken
-
Create a new Nginx server block configuration file for the site:
sudo nano /etc/nginx/sites-available/maiken.slowyou.io.conf
-
Add the following configuration to the file:
server { server_name maiken.slowyou.io; # managed by Certbot root /var/www/html/slowyouio/maiken; index index.php index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; } listen [::]:443 ssl; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/slowyou.io/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/slowyou.io/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { listen 80; server_name maiken.slowyou.io; return 301 https://$server_name$request_uri; }
-
Save the file and exit the editor.
-
Create a symbolic link to enable the site:
sudo ln -s /etc/nginx/sites-available/maiken.slowyou.io.conf /etc/nginx/sites-enabled/
-
Test the Nginx configuration for syntax errors:
sudo nginx -t
-
Reload Nginx to apply the changes:
sudo systemctl reload nginx
-
Ensure PHP-FPM is installed and running:
sudo apt install php8.1-fpm sudo systemctl start php8.1-fpm sudo systemctl enable php8.1-fpm
-
Set the appropriate permissions on the website directory:
sudo chown -R www-data:www-data /var/www/html/slowyouio/maiken
-
Create a PHP file to test PHP processing:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/slowyouio/maiken/info.php
-
Visit
https://maiken.slowyou.io/info.php
in your web browser to confirm that PHP is working correctly with Nginx.
That's it! Your maiken.slowyou.io
site is now set up on your Ubuntu server with Nginx, PHP 8.1, and HTTPS support. You can add your website files to the /var/www/html/slowyouio/maiken
directory and they will be served by Nginx.