0
我用PHP創建了nginx服務器,但它不工作。docker nginx,php有什麼不對?
這是我的搬運工,compose.yml:
web:
image: nginx:latest
ports:
- 127.0.0.1:8080:80
volumes:
- ./docs:/docs
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php:
image: php:latest
volumes:
- ./docs:/docs
site.conf:
server {
listen 80;
index index.php;
server_name php.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /docs;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
/etc/hosts中
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 php.local
碼頭工人在終端運行沒有錯誤:
sudo docker-compose up -d
Starting php_php_1
Starting php_web_1
而當我輸入瀏覽器127:0:0:1:8080或php.local:8080它被拒絕連接爲什麼?
我使用Fedora。根據教程,我不需要碼頭機器。它應該在本地主機...呼籲http://192.168.99.100:8080不工作。 – smiady