Thread: Tech Roboscripts Nginx conf
View Single Post
Old 01-24-2025, 03:20 PM  
Freedom6995
Friends of Venus founder
 
Freedom6995's Avatar
 
Industry Role:
Join Date: Jul 2010
Posts: 1,967
this was the code it spit out:

Code:
server {
    listen 80;
    server_name domain.com www.domain.com;
    
    # Redirect all HTTP to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name domain.com www.domain.com;
    
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
    
    root /home/httpd/html/domain.com/public_html;
    index index.php;

    access_log /var/log/nginx/domain.com.log combined;
    error_log /var/log/nginx/domain.com.error_log warn;

    location ~ /.well-known {
        root /var/www;
        allow all;
    }

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

    # Example for static content caching
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf)$ {
        expires max;
        log_not_found off;
        add_header Cache-Control "public";
    }

    location ~ /\. {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_pass php56-fpm;  # Ensure the upstream here matches your PHP-FPM configuration
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
Freedom6995 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote