default.nginxconf 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. server {
  2. listen 80 default_server;
  3. listen [::]:80 default_server;
  4. # SSL configuration
  5. #
  6. # listen 443 ssl default_server;
  7. # listen [::]:443 ssl default_server;
  8. #
  9. # Note: You should disable gzip for SSL traffic.
  10. # See: https://bugs.debian.org/773332
  11. #
  12. # Read up on ssl_ciphers to ensure a secure configuration.
  13. # See: https://bugs.debian.org/765782
  14. #
  15. # Self signed certs generated by the ssl-cert package
  16. # Don't use them in a production server!
  17. #
  18. # include snippets/snakeoil.conf;
  19. root /var/www/html;
  20. # Add index.php to the list if you are using PHP
  21. index index.html index.htm index.php;
  22. server_name _;
  23. location / {
  24. # First attempt to serve request as file, then
  25. # as directory, then fall back to displaying a 404.
  26. try_files $uri $uri/ =404;
  27. }
  28. location /phpmyadmin {
  29. root /usr/share/webapps/;
  30. # Deny static files
  31. location ~ ^/phpMyAdmin/(README|LICENSE|ChangeLog|DCO)$ {
  32. deny all;
  33. }
  34. # Deny .md files
  35. location ~ ^/phpMyAdmin/(.+\.md)$ {
  36. deny all;
  37. }
  38. # Deny setup directories
  39. location ~ ^/phpMyAdmin/(doc|sql|setup)/ {
  40. deny all;
  41. }
  42. location ~ ^/phpmyadmin/(.+\.php)$ {
  43. fastcgi_pass 127.0.0.1:9000;
  44. fastcgi_index index.php;
  45. include fastcgi.conf;
  46. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  47. try_files $uri $document_root$fastcgi_script_name =404;
  48. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  49. fastcgi_param PATH_INFO $fastcgi_path_info;
  50. fastcgi_param HTTP_PROXY "";
  51. fastcgi_param HTTPS on;
  52. fastcgi_request_buffering off;
  53. }
  54. location ~ ^/phpmyadmin/(.*\.(eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|xls|tar|bmp))$ {
  55. root /usr/share/webapps/;
  56. expires 30d;
  57. log_not_found off;
  58. access_log off;
  59. }
  60. }
  61. # pass PHP scripts to FastCGI server
  62. location ~ \.php$ {
  63. fastcgi_pass 127.0.0.1:9000;
  64. fastcgi_index index.php;
  65. include fastcgi.conf;
  66. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  67. }
  68. # deny access to .htaccess files, if Apache's document root
  69. # concurs with nginx's one
  70. location ~ /\.ht {
  71. deny all;
  72. }
  73. ## Images and static content is treated different
  74. location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
  75. access_log off;
  76. expires max;
  77. }
  78. location ~ /(libraries|setup/frames|setup/libs) {
  79. deny all;
  80. return 404;
  81. }
  82. location /nginx_status {
  83. stub_status on;
  84. access_log off;
  85. allow 127.0.0.1;
  86. # allow CURRENT-SERVER-IP;
  87. deny all;
  88. }
  89. }