Advertisement
alpa_s

Untitled

Jun 14th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. / # cat /etc/nginx/conf.d/vhost.conf
  2. server {
  3. listen 80;
  4. server_name fazze.loc;
  5.  
  6. set $base_root /app;
  7. root $base_root;
  8.  
  9. #error_log /var/log/nginx/advanced.local.error.log warn;
  10. #access_log /var/log/nginx/advanced.local.access.log main;
  11. charset UTF-8;
  12. index index.php index.html;
  13.  
  14. location / {
  15. root $base_root/frontend/web;
  16. try_files $uri $uri/ /frontend/web/index.php$is_args$args;
  17.  
  18. # omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
  19. #location ~ ^/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
  20. # log_not_found off;
  21. # access_log off;
  22. # try_files $uri =404;
  23. #}
  24.  
  25. location ~ ^/assets/.+\.php(/|$) {
  26. deny all;
  27. }
  28. }
  29.  
  30. location /admin {
  31. alias $base_root/backend/web/;
  32.  
  33. # redirect to the URL without a trailing slash (uncomment if necessary)
  34. #location = /admin/ {
  35. # return 301 /admin;
  36. #}
  37.  
  38. # prevent the directory redirect to the URL with a trailing slash
  39. location = /admin {
  40. # if your location is "/backend", try use "/backend/backend/web/index.php$is_args$args"
  41. # bug ticket: https://trac.nginx.org/nginx/ticket/97
  42. try_files $uri /backend/web/index.php$is_args$args;
  43. }
  44.  
  45. # if your location is "/backend", try use "/backend/backend/web/index.php$is_args$args"
  46. # bug ticket: https://trac.nginx.org/nginx/ticket/97
  47. try_files $uri $uri/ /backend/web/index.php$is_args$args;
  48.  
  49. # omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
  50. #location ~ ^/admin/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
  51. # log_not_found off;
  52. # access_log off;
  53. # try_files $uri =404;
  54. #}
  55.  
  56. location ~ ^/admin/assets/.+\.php(/|$) {
  57. deny all;
  58. }
  59. }
  60.  
  61. location ~ ^/.+\.php(/|$) {
  62. rewrite (?!^/((frontend|backend)/web|admin))^ /frontend/web$uri break;
  63. rewrite (?!^/backend/web)^/admin(/.+)$ /backend/web$1 break;
  64.  
  65. fastcgi_pass php-fpm; # proxy requests to a TCP socket
  66. #fastcgi_pass unix:/var/run/php-fpm.sock; # proxy requests to a UNIX domain socket (check your www.conf file)
  67. fastcgi_split_path_info ^(.+\.php)(.*)$;
  68. include /etc/nginx/fastcgi_params;
  69. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  70. try_files $fastcgi_script_name =404;
  71. }
  72.  
  73. location ~ /\. {
  74. deny all;
  75. }
  76. }
  77.  
  78. ## PHP-FPM Servers ##
  79. upstream php-fpm {
  80. server app:9000;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement