Do I need to prepare two identical php projects and put them in the working directories of php and nginx respectively?
I only put the php project in the php container. I did not put it in the nginx working directory. Now I can only Access php files but cannot access html files
天蓬老师2017-05-16 13:18:04
nginx configuration can specify the php directory, just specify it in a location.
曾经蜡笔没有小新2017-05-16 13:18:04
First of all, the files that nginx will execute through your access can be specified in the conf of nginx;
Secondly, you can make a link on the server;
Thirdly, you can change two identical files, as long as the server The space format above is large enough
ringa_lee2017-05-16 13:18:04
When configuring nginx, you can specify the file directory where the project is located, as shown in the following root path.
server
{
listen 80;
server_name domainName;
index index.html index.htm index.php;
root /path/to/your/project/;
}
ringa_lee2017-05-16 13:18:04
nginx There are many ways to use PHP, such as fastcgi. Remember to use the root + try_files mechanism to configure static files.
For a little more fun, you can use symbolic links to make two paths point to the same directory.
黄舟2017-05-16 13:18:04
If you use Docker, you can use Volume, put the file in Volume, and then mount this Volume in both Nginx and PHP containers. Isn’t that enough?
Multiple containers are best managed using Docker Compose, where you can specify the name of each container, such as Nginx and PHP. This will be much more convenient.
阿神2017-05-16 13:18:04
What is the php directory? I only know nginx’s root
Configuring the web directory