Objective#
Based on the Docker image built with webdevops/php-nginx
, pseudo-static is supported by default. However, I forgot which file it is, so I'm recording the process specifically.
Note: Currently, only the file paths have been sorted out. I need to further study how to customize it properly and elegantly. Orz.
Command Memo#
# Enter the container
docker exec -it zbp_ForAPP /bin/bash
# Execute inside the container
find /|grep nginx.conf
The main file path is: /etc/nginx/nginx.conf
, but it also references various external files.
For example: include /etc/nginx/modules-enabled/*.conf;
, the corresponding file is actually located at: /usr/share/nginx/modules-available/
; ← However, these are references to *.so
files.
Then there is: include /etc/nginx/conf.d/*.conf;
and include /etc/nginx/sites-enabled/*;
.
However, the latter is empty by default, and the main files involved in the former are all located in /opt/docker/etc/nginx
.
To query the required paths, use the following:
# Enter the container
docker exec -it zbp_ForAPP /bin/bash
cd /etc/nginx/conf.d
ls
# 10-docker.conf
readlink *
# /opt/docker/etc/nginx/main.conf
cd /opt/docker/etc/nginx
ls
# conf.d main.conf ssl vhost.common.d vhost.ssl.conf
# global.conf php.conf vhost.common.conf vhost.conf
# Outside the container
# Copy files
NGINX_DIR=/home/www/zbp_ForAPP/nginx
docker cp zbp_ForAPP:/etc/nginx/nginx.conf "${NGINX_DIR}/"
docker cp zbp_ForAPP:/opt/docker/etc/nginx "${NGINX_DIR}/"
# docker cp zbp_ForAPP:/usr/share/nginx/modules-available "${NGINX_DIR}/"
Result#
In terms of the container's internal path, there is the following file:
/opt/docker/etc/nginx/vhost.common.d/10-location-root.conf
Content:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
It is equivalent to pseudo-static in the general sense. Probably...