fork download
  1. server {
  2. charset utf-8;
  3. client_max_body_size 128M;
  4.  
  5. listen 80; ## listen for ipv4
  6. #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
  7.  
  8. server_name frontend.test.localhost;
  9. root /var/www/yiitest/web/;
  10. index index.php;
  11.  
  12. location / {
  13. # Redirect everything that isn't a real file to index.php
  14. try_files $uri $uri/ /index.php$is_args$args;
  15. }
  16.  
  17. # uncomment to avoid processing of calls to non-existing static files by Yii
  18. #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
  19. # try_files $uri =404;
  20. #}
  21. #error_page 404 /404.html;
  22.  
  23. # deny accessing php files for the /assets directory
  24. location ~ ^/assets/.*\.php$ {
  25. deny all;
  26. }
  27.  
  28. location ~ \.php$ {
  29. include fastcgi_params;
  30. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  31. fastcgi_pass 127.0.0.1:9000;
  32. #fastcgi_pass unix:/var/run/php7.2-fpm.sock;
  33. try_files $uri =404;
  34. }
  35.  
  36. location ~* /\. {
  37. deny all;
  38. }
  39. }
Success #stdin #stdout 0.02s 24272KB
stdin
Standard input is empty
stdout
 server {
        charset utf-8;
        client_max_body_size 128M;

        listen 80; ## listen for ipv4
        #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

        server_name frontend.test.localhost;
        root        /var/www/yiitest/web/;
        index       index.php;

        location / {
            # Redirect everything that isn't a real file to index.php
            try_files $uri $uri/ /index.php$is_args$args;
        }

        # uncomment to avoid processing of calls to non-existing static files by Yii
        #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
        #    try_files $uri =404;
        #}
        #error_page 404 /404.html;

        # deny accessing php files for the /assets directory
        location ~ ^/assets/.*\.php$ {
            deny all;
        }

        location ~ \.php$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass 127.0.0.1:9000;
            #fastcgi_pass unix:/var/run/php7.2-fpm.sock;
            try_files $uri =404;
        }
    
        location ~* /\. {
            deny all;
        }
    }