Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 443 ssl http2;
- ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
- ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
- location ^/blog{
- root /var/www/html/mydomain.com/blog;
- index index.php;
- try_files $uri $uri/ /blog/index.php$is_args$args;
- location ~ \.php$ {
- include snippets/fastcgi-php.conf;
- fastcgi_pass unix:/run/php/php7.4-fpm.sock;
- }
- }
- root /var/www/html/mydomain.com/my_laravel/public;
- index index.php index.html index.htm;
- error_log /var/log/nginx/mydomain.com.error.log;
- server_name mydomain.com www.mydomain.com;
- location / {
- try_files $uri $uri/ /index.php?$args;
- }
- if ($http_user_agent ~* (MJ12bot|SemrushBot|AhrefsBot|DotBot) ) { return 301 http://127.0.0.1/; }
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/run/php/php7.4-mydomain.com-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location = /favicon.ico {
- log_not_found off;
- access_log off;
- }
- location = /robots.txt {
- try_files $uri $uri/ /index.php?$args;
- allow all;
- log_not_found off;
- access_log off;
- }
- location ~ /\.ht {
- deny all;
- }
- location ~ /\.us {
- deny all;
- }
- }
- server {
- if ($host = www.mydomain.com) {
- return 301 https://$host$request_uri;
- } # managed by Certbot
- if ($host = mydomain.com) {
- return 301 https://$host$request_uri;
- } # managed by Certbot
- listen 80;
- server_name mydomain.com www.mydomain.com;
- return 404; # managed by Certbot
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement