Nginx.config 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # https://www.nginx.com/resources/wiki/start/
  5. # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
  6. # https://wiki.debian.org/Nginx/DirectoryStructure
  7. #
  8. # In most cases, administrators will remove this file from sites-enabled/ and
  9. # leave it as reference inside of sites-available where it will continue to be
  10. # updated by the nginx packaging team.
  11. #
  12. # This file will automatically load configuration files provided by other
  13. # applications, such as Drupal or Wordpress. These applications will be made
  14. # available underneath a path with that package name, such as /drupal8.
  15. #
  16. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  17. ##
  18. # Default server configuration
  19. #
  20. server {
  21. #listen 80 default_server;
  22. listen 127.0.0.1:80;
  23. #listen [::]:80 default_server;
  24. # SSL configuration
  25. #
  26. # listen 443 ssl default_server;
  27. # listen [::]:443 ssl default_server;
  28. #
  29. # Note: You should disable gzip for SSL traffic.
  30. # See: https://bugs.debian.org/773332
  31. #
  32. # Read up on ssl_ciphers to ensure a secure configuration.
  33. # See: https://bugs.debian.org/765782
  34. #
  35. # Self signed certs generated by the ssl-cert package
  36. # Don't use them in a production server!
  37. #
  38. # include snippets/snakeoil.conf;
  39. server_name domain.Name;
  40. return 301 https://$server_name/$request_uri;
  41. }
  42. server {
  43. #listen 443 ssl http2;
  44. #listen [::]:443 ssl;
  45. listen 127.0.0.1:443 ssl;
  46. ssl on;
  47. ssl_certificate PATH;
  48. ssl_certificate_key PATH;
  49. #openssl dhparam out dhparam.pem 2048
  50. #openssl dhparam out dhparam.pem 4096
  51. ssl_dhparam /home/acme/data/dhparam.pem;
  52. ssl_session_cache shared:SSL:10m;
  53. ssl_session_timeout 5m;
  54. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  55. ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"; #屏蔽不安全的加密方式
  56. root /var/www/html;
  57. # Add index.php to the list if you are using PHP
  58. index index.html index.htm index.nginx-debian.html index.php tail.html ;
  59. server_name _;
  60. location /PATH/ {
  61. proxy_http_version 1.1;
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header Connection "upgrade";
  64. proxy_set_header Host $http_host;
  65. if ($http_host = "domain.Name" ) {
  66. proxy_pass http://127.0.0.1:10086;
  67. }
  68. }
  69. # pass PHP scripts to FastCGI server
  70. #
  71. location ~ \.php$ {
  72. include snippets/fastcgi-php.conf;
  73. #
  74. # # With php-fpm (or other unix sockets):
  75. fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  76. # # With php-cgi (or other tcp sockets):
  77. # fastcgi_pass 127.0.0.1:9000;
  78. }
  79. # deny access to .htaccess files, if Apache's document root
  80. # concurs with nginx's one
  81. #
  82. #location ~ /\.ht {
  83. # deny all;
  84. #}
  85. }
  86. # Virtual Host configuration for example.com
  87. #
  88. # You can move that to a different file under sites-available/ and symlink that
  89. # to sites-enabled/ to enable it.
  90. #
  91. #server {
  92. # listen 80;
  93. # listen [::]:80;
  94. #
  95. # server_name example.com;
  96. #
  97. # root /var/www/example.com;
  98. # index index.html;
  99. #
  100. # location / {
  101. # try_files $uri $uri/ =404;
  102. # }
  103. #}