default 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. # ==============================================
  21. # 1. git.leadmuta.com → 转发到本地 3000 端口
  22. # ==============================================
  23. server {
  24. listen 80;
  25. server_name git.leadmuta.com;
  26. return 301 https://$host$request_uri;
  27. }
  28. server {
  29. listen 443 ssl http2;
  30. server_name git.leadmuta.com;
  31. # SSL 证书路径(改成你自己的)
  32. ssl_certificate /etc/nginx/ssl/git.leadmuta.com.pem;
  33. ssl_certificate_key /etc/nginx/ssl/git.leadmuta.com.key;
  34. # 反向代理 → 3000 端口
  35. location / {
  36. proxy_pass http://127.0.0.1:3000;
  37. proxy_set_header Host $host;
  38. proxy_set_header X-Real-IP $remote_addr;
  39. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  40. proxy_set_header X-Forwarded-Proto $scheme;
  41. proxy_read_timeout 600;
  42. }
  43. }
  44. # ==============================================
  45. # 2. www.leadmuta.com → 主站(静态网站/你自己的服务)
  46. # ==============================================
  47. server {
  48. listen 80;
  49. server_name www.leadmuta.com leadmuta.com;
  50. return 301 https://$host$request_uri;
  51. }
  52. server {
  53. listen 443 ssl http2;
  54. server_name www.leadmuta.com;
  55. # SSL 证书路径(改成你自己的)
  56. ssl_certificate /etc/nginx/ssl/www.leadmuta.com.pem;
  57. ssl_certificate_key /etc/nginx/ssl/www.leadmuta.com.key;
  58. # 安全优化(不用改)
  59. ssl_protocols TLSv1.2 TLSv1.3;
  60. ssl_ciphers HIGH:!aNULL:!MD5;
  61. ssl_prefer_server_ciphers on;
  62. # 网站根目录
  63. root /var/www/html;
  64. index index.html index.htm;
  65. location / {
  66. try_files $uri $uri/ =404;
  67. }
  68. }
  69. # Virtual Host configuration for example.com
  70. #
  71. # You can move that to a different file under sites-available/ and symlink that
  72. # to sites-enabled/ to enable it.
  73. #
  74. #server {
  75. # listen 80;
  76. # listen [::]:80;
  77. #
  78. # server_name example.com;
  79. #
  80. # root /var/www/example.com;
  81. # index index.html;
  82. #
  83. # location / {
  84. # try_files $uri $uri/ =404;
  85. # }
  86. #}