Nginx subdomain with SSL certificate

Nginx subdomain with SSL certificate

Create A zone,  folder.infinitynetwork.ro  1800 IN A 123.345.234.4

Create the folder mkdir /var/www/html/folder.infinitynetwork.ro

Add the config for nginx

vim /etc/nginx/sites-available/folder.infinitynetwork.ro

server {

listen 443;

ssl_certificate /etc/ssl/certs/cert.crt;

ssl_certificate_key /etc/ssl/private/private.key;

server_name folder.infinitynetwork.ro www.folder.infinitynetwork.ro;

root /var/www/html/folder.infinitynetwork.ro;

index index.php index.html index.htm;

# log access and errors
access_log /var/log/nginx/folder.infinitynetwork.ro.access_log;
error_log

/var/log/nginx/folder.infinitynetwork.ro.error_log;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}

location ~ /\.ht {
deny all;
}
}

And add the include line in /etc/nginx/nginx.conf

http {
# Basic Settings
....
include /etc/nginx/sites-available/folder.infinitynetwork.ro;
...

}

Make a symlink to the enabled sites: ln -s /etc/sites-available/folder.infinitynetwork.ro /etc/sites-enabled/folder.infinitynetwork.ro Restart server service nginx restart

Loading