Pinned Nginx Server Config

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Nginx Server Config

    hey hab hier einmal eine nginx config als vorlage by Geartwo

    Source Code

    1. server {
    2. listen 80;
    3. listen [::]:80;
    4. server_name example.com;
    5. root /var/www/example.com;
    6. index index.php;
    7. location ~ \.php$ {
    8. fastcgi_pass unix://run/php5-fpm.sock;
    9. fastcgi_index index.php;
    10. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    11. fastcgi_param HTTP_PROXY "";
    12. include fastcgi_params;
    13. }
    14. # security headers
    15. add_header X-Frame-Options "SAMEORIGIN";
    16. add_header X-XSS-Protection "1; mode=block";
    17. add_header X-Content-Type-Options "nosniff";
    18. add_header Referrer-Policy "no-referrer-when-downgrade";
    19. add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'";
    20. # gzip
    21. gzip on;
    22. gzip_vary on;
    23. gzip_proxied any;
    24. gzip_comp_level 6;
    25. gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
    26. location ~ \.ht* {
    27. deny all;
    28. }
    29. location ~ \.htaccess {
    30. allow 127.0.0.1;
    31. deny all;
    32. }
    33. location /\.htaccess {
    34. }
    35. location ~\.(ini|log|conf|txt)$ {
    36. allow 127.0.0.1;
    37. deny all;
    38. error_page 404 / ;
    39. }
    40. error_page 404 /php/404/404.php;
    41. location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
    42. expires 7d;
    43. }
    44. location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff|woff2)$ {
    45. add_header Access-Control-Allow-Origin "*";
    46. expires 7d;
    47. }
    48. }
    Display All