Home  >  Article  >  Backend Development  >  nginx - php linux virtual directory

nginx - php linux virtual directory

WBOY
WBOYOriginal
2016-09-11 11:34:14994browse

PHP+CENTOS+NGINX

I want to implement cross-directory upload with PHP. For example, if we set up a virtual directory in IIS under the WIN server, then we have the permissions of that directory (only relative to this site), and can upload, delete, and access this directory.

I want to achieve this requirement under NGINX. For example, my website is under /var/www, but I need to put the pictures I uploaded under /var/pic/, and I can set an alias to access the files in this directory.

Reply content:

PHP+CENTOS+NGINX

I want to implement cross-directory upload with PHP. For example, if we set up a virtual directory in IIS under the WIN server, then we have the permissions of that directory (only relative to this site), and can upload, delete, and access this directory.

I want to achieve this requirement under NGINX. For example, my website is under /var/www, but I need to put the pictures I uploaded under /var/pic/, and I can set an alias to access the files in this directory.

Then you set it up. Permissions under Linux are only related to the owner and permission mode.

For example, the php-fpm process is the www-data user (the default user in Ubuntu, not necessarily this in other distributions), then as long as the www-data user has write permissions to the directory, php can write to the directory.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn