Nginx subdomain with SSL certificate

Nginx subdomain with SSL certificate

Create A zone,  1800 IN A 123.345.234.4

Create the folder mkdir /var/www/html/

Add the config for nginx

vim /etc/nginx/sites-available/

server {

listen 443;

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

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


root /var/www/html/;

index index.php index.html index.htm;

# log access and errors
access_log /var/log/nginx/;


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/;


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

Leave a Reply

Your email address will not be published.