Project uses Laravel.
first of all, Nginx runs in one Docker and Php runs in another Docker. Currently, Swoole, is enabled in PhpDocker and listens through http://127.0.0.1:1215(swoole in this container), and the result can be output normally. But when you forward access through Nginx, you can"t. Instead of executing php index.php.
, you directly output the index.php contents under the public folder of Laravel.the following is detailed configuration information.
http {
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/track/public;
index index.php index.html index.htm;
-sharp Make site accessible from http://localhost/
server_name *.baixing.cn *.baixing.com;
-sharp Add stdout logging
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log;
-sharpgzip
gzip on;
gzip_comp_level 6;
gzip_types text/css application/javascript text/xml application/json application/xml image/jpeg; -sharp append to default: text/html
gzip_vary off; -sharpvary
gzip_disable "msie6";
gzip_min_length 66;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_set_header X-Real-IP $remote_addr;
if (!-e $request_filename) {
proxy_pass http://192.168.10.2:1215;
}
}
}
}
I hope those who have experience in this field can give some help. Thank you.