centos 8
    /etc/nginx/conf.d/default.conf

    1. server {
    2. listen 80;
    3. server_name localhost 119.45.15.239 touchfish.tech;
    4. rewrite ^(.*)$ https://touchfish.tech$1 permanent;
    5. }
    6. server {
    7. listen 443 ssl;
    8. #listen 80;
    9. root /usr/share/nginx/html;
    10. server_name touchfish.tech;
    11. #server_name localhost;
    12. ssl_certificate touchfish.tech_bundle.crt;
    13. ssl_certificate_key touchfish.tech.key;
    14. ssl_session_timeout 5m;
    15. ssl_protocols TLSv1.2 TLSv1.3;
    16. ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    17. ssl_prefer_server_ciphers on;
    18. #access_log /var/log/nginx/host.access.log main;
    19. location / {
    20. try_files $uri $uri/ @router;
    21. proxy_pass CDN 上的 html 文件地址;
    22. #index index.html index.htm index.php;
    23. }
    24. location @router {
    25. rewrite ^.*$ / last;
    26. }
    27. #error_page 404 /404.html;
    28. # redirect server error pages to the static page /50x.html
    29. #
    30. error_page 500 502 503 504 /50x.html;
    31. location = /50x.html {
    32. root /usr/share/nginx/html;
    33. }
    34. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    35. #
    36. #location ~ \.php$ {
    37. # proxy_pass http://127.0.0.1;
    38. #}
    39. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    40. #
    41. location ~ \.php$ {
    42. fastcgi_pass 127.0.0.1:9000;
    43. fastcgi_index index.php;
    44. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    45. include fastcgi_params;
    46. }
    47. #deny access to .htaccess files, if Apache's document root
    48. #concurs with nginx's one
    49. #
    50. #location ~ /\.ht {
    51. # deny all;
    52. #}
    53. location ~ \.(gif|jpg|png|css|js|ico)$ {
    54. expires 365d;
    55. }
    56. }