Un utente ha chiesto 👇
Sto cercando di installare WordPress “installato utilizzando l’immagine docker” sul server Nginx.
Ho eseguito l’immagine docker utilizzando quanto segue docker-compose.yml
file
version: "3"
services:
wordpress_app:
image: wordpress:latest
restart: always
container_name: wordpress_app
environment:
WORDPRESS_DB_HOST: mysql_server:3306
WORDPRESS_DB_USER: db_username
WORDPRESS_DB_PASSWORD: db_password
WORDPRESS_DB_NAME: db_name
depends_on:
- mysql_server
volumes:
- /data/wordpress_app/public_html:/var/www/html
ports:
- 8000:80
- 8001:443
mysql_server:
image: mysql:latest
restart: always
container_name: mysql_server
environment:
MYSQL_DATABASE: db_name
MYSQL_USER: db_username
MYSQL_PASSWORD: db_password
MYSQL_ROOT_PASSWORD: root_password
volumes:
- mysql_server_data:/var/lib/mysql
volumes:
mysql_server_data:
networks:
default:
external:
name: nginx-network
Ora, voglio eseguire il proxy del dominio pubblico usa.mydomain.com
per localhost:8000
server {
listen 80;
server_name usa.mydomin.com;
root /var/www/html;
access_log off;
error_log /var/log/nginx/usa.mydomain.com-error.log;
index index.html index.php;
location / {
# First attempt to serve request as file, then as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on localhost:8000
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass localhost:8000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
Tuttavia, quando navigo su usa.mydomain.com trovo
** 403 Proibito ** nginx / 1.14.0 (Ubuntu)
Come posso correggere questo errore?
(@crestapps)
3 mesi, 3 settimane fa
Ho cambiato Nginx con la seguente configurazione
server {
listen 80;
server_name usa.mydomin.com;
#root / var / www / html; # <<<<< VENDI QUESTO
root / data / wordpress_app / public_html; # <<<<< ALTRO QUESTO
access_log come;
error_log /var/log/nginx/usa.mydomain.com-error.log;
index.html index.php;
Posizione / {
# Prova prima a servire l’applicazione come file, poi come directory, quindi torna indietro per mostrare 404.
try_files $ uri $ uri //index.php?$args;
}
# inoltra gli script PHP a un server FastCGI in ascolto su localhost: 8000
posizione ~ .php $ {
fastcgi_split_path_info ^ (. + . php) (/.+) $;
fastcgi_pass localhost: 8000;
fastcgi_index index.php;
fastcgi_params include;
parametro_fastcgi SCRIPT_FILENAME $ root_documento $ nome_script_fastcgi;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
}
}
Ma ora lo capisco
mentre guardo i log ottengo il seguente errore
2020/10/16 15:22:58 [error] 1475#1475: *68 upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream, client: MyIpAddress, server: usa.mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://[::1]:8000", host: "usa.mydomain.com"
2020/10/16 15:22:58 [error] 1475 # 1475: * 68 upstream ha inviato una versione del protocollo FastCGI non supportata: 72 durante la lettura dell’intestazione della risposta dal fiume, client: MyIpAddress, server: usa.mydomain.com, ask: “GET /favicon.ico HTTP / 1.1”, upstream: “fastcgi: //127.0.0.1: 8000”, host: “usa.mydomain.com”, redirector: “http://usa.mydomain.com/”
Was this helpful?
0 / 0