Created
March 11, 2021 15:25
-
-
Save marianmirzacu/22cd3e0f8c89154bb30cc3de178feee1 to your computer and use it in GitHub Desktop.
nginx / wp / php8.0-fpm / let's encrypt - config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name DOMAIN.ro; | |
return 301 https://www.DOMAIN.ro$request_uri; | |
listen 443 ssl http2; # managed by Certbot | |
listen [::]:443 ssl http2; | |
ssl_certificate /etc/letsencrypt/live/DOMAIN.ro/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/DOMAIN.ro/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 { | |
server_name www.DOMAIN.ro; | |
root /var/www/DOMAIN.ro; | |
index index.html index.php; | |
access_log /var/log/nginx/DOMAIN.ro_access.log; | |
error_log /var/log/nginx/DOMAIN.ro_error.log; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_intercept_errors on; | |
fastcgi_pass unix:/run/php/php8.0-fpm.sock; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
listen 443 ssl http2; # managed by Certbot | |
listen [::]:443 ssl http2; | |
ssl_certificate /etc/letsencrypt/live/DOMAIN.ro/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/DOMAIN.ro/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 { | |
if ($host = DOMAIN.ro) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
server_name DOMAIN.ro; | |
listen 80; | |
listen [::]:80; | |
return 404; # managed by Certbot | |
} | |
server { | |
if ($host = www.DOMAIN.ro) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
server_name www.DOMAIN.ro; | |
listen 80; | |
listen [::]:80; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment