In nginx + php environment, my php project must be placed in the nginx working directory and the php working directory. Isn't this two copies?
漂亮男人
漂亮男人 2017-05-16 13:16:04
0
7
805

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

漂亮男人
漂亮男人

reply all(7)
Peter_Zhu

nginx configuration can specify the php directory, just specify it in a location.

为情所困

No, just point the nginx configuration directory to your project path

曾经蜡笔没有小新

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

左手右手慢动作

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/;

}
左手右手慢动作

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.

黄舟

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.

阿神

What is the php directory? I only know nginx’s rootConfiguring the web directory

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!