PHP容器化demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9 KiB

3 years ago
  1. # gq-hello.public.conf
  2. # gq-hello nginx public config.
  3. # This api is a [public] api.
  4. # @version 170624:8
  5. # server config
  6. server {
  7. listen 80;
  8. server_name gq-hello.juejin.im;
  9. # origin sessings
  10. include /data/apps/nginx/conf/origin/gold.xitu.io_and_juejin.im.conf;
  11. default_type 'text/plain'; # or browser will download page
  12. root /data/repo/gq-hello/src/;
  13. access_log /dev/stdout;
  14. error_log /dev/stderr;
  15. client_body_temp_path /data/tmp/nginx/client_body_temp/ 1 2;
  16. proxy_temp_path /data/tmp/nginx/proxy_temp/ 1 2;
  17. fastcgi_temp_path /data/tmp/nginx/fastcgi_temp/ 1 2;
  18. rewrite "^(.*)/v1/sample$" $1/SampleApi.php?$query_string last;
  19. rewrite "^(.*)/status$" $1/status.php last;
  20. # global location settings
  21. location / {
  22. return 200;
  23. }
  24. location = /ENV {
  25. allow 127.0.0.1;
  26. deny all;
  27. }
  28. location ~* ^/DOCUMENTS{
  29. return 404;
  30. }
  31. location ~* ^/logs{
  32. return 404;
  33. }
  34. location ~* ^/src{
  35. return 404;
  36. }
  37. location ~* ^/config{
  38. return 404;
  39. }
  40. location = /favicon.ico {
  41. allow all;
  42. log_not_found off;
  43. access_log off;
  44. }
  45. location ~ /\. {
  46. deny all;
  47. access_log off;
  48. log_not_found off;
  49. }
  50. location ~ \.php$ {
  51. if ( $fastcgi_script_name ~ \..*\/.*php ) {
  52. return 403;
  53. }
  54. include fastcgi.conf;
  55. #这里如果是本地测试,要使用docker的ip,还不能解析名称,要使用容器ip,使用hostname -I
  56. #进入容器要使用docker exec -i -t {dockerId} /bin/sh
  57. #查看dockerId使用命令docker ps
  58. fastcgi_pass gq-hello:9000;
  59. fastcgi_index index.php;
  60. }
  61. }