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

# gq-hello.public.conf
# gq-hello nginx public config.
# This api is a [public] api.
# @version 170624:8
# server config
server {
listen 80;
server_name gq-hello.juejin.im;
# origin sessings
include /data/apps/nginx/conf/origin/gold.xitu.io_and_juejin.im.conf;
default_type 'text/plain'; # or browser will download page
root /data/repo/gq-hello/src/;
access_log /dev/stdout;
error_log /dev/stderr;
client_body_temp_path /data/tmp/nginx/client_body_temp/ 1 2;
proxy_temp_path /data/tmp/nginx/proxy_temp/ 1 2;
fastcgi_temp_path /data/tmp/nginx/fastcgi_temp/ 1 2;
rewrite "^(.*)/v1/sample$" $1/SampleApi.php?$query_string last;
rewrite "^(.*)/status$" $1/status.php last;
# global location settings
location / {
return 200;
}
location = /ENV {
allow 127.0.0.1;
deny all;
}
location ~* ^/DOCUMENTS{
return 404;
}
location ~* ^/logs{
return 404;
}
location ~* ^/src{
return 404;
}
location ~* ^/config{
return 404;
}
location = /favicon.ico {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~ \.php$ {
if ( $fastcgi_script_name ~ \..*\/.*php ) {
return 403;
}
include fastcgi.conf;
#这里如果是本地测试,要使用docker的ip,还不能解析名称,要使用容器ip,使用hostname -I
#进入容器要使用docker exec -i -t {dockerId} /bin/sh
#查看dockerId使用命令docker ps
fastcgi_pass gq-hello:9000;
fastcgi_index index.php;
}
}