The idea of developing virtual host management system in PHP
Source: Internet
Author: User
For Nginx, include the virtual host configuration in the master configuration nginx.conf:
Include sites-enabled/*.conf;
When creating a new virtual host, create a new file in the Sites-enables, such as:
Sites-enabled/a.com.conf
server {
Listen 80;
server_name www.a.com;
Location/{
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $remote _addr;
Proxy_set_header Host $host;
Proxy_pass http://127.0.0.1:8080;
}
}
That is, access to the www.a.com will reverse proxy to the back-end Apache monitoring 8080 processing.
with Nginx forwarding, you can run multiple versions of Apache (PHP) on a single server, as long as Apache listens on different ports. For example, Apache (PHP5.4) listens on the port is 8081, that needs the PHP5.4 support user website to generate the Nginx virtual host configuration to forward to 8081 port.
The Apache Master profile httpd.conf is loaded into the virtual host configuration:
Include conf/extra/httpd-vhosts.conf
There are cofn files in the httpd-vhosts.conf that are loaded into the vhosts:
Include conf/extra/vhosts/*.conf
Inside the conf/extra/vhosts/a.com.conf virtual host:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
/png/www/a.com is the directory of the virtual host, the public_html is the root directory, for the virtual host users to assign a directory of FTP users, such as the use of proftpd ftpasswd to generate an account:
The development of a virtual host management system, is simply called adduser/ftpasswd generation of FTP accounts, as well as the generation of Nginx and Apache virtual host configuration, generated after the use of nginx-t and httpd- s test configuration is correct after the overloaded service is in effect. PHP provides a number of file system operation functions and string processing functions (replacement/regular matching), PHP has good support for the database, storage of virtual host user information is naturally very convenient.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.