A user has two domain names, which are aaa.yoursite.com and bbb.yoursite.comThe user wants to open different subdirectory website programs when accessing the above two sites.
Let’s assume that the user has already uploaded code for the two sites to the subdirectories /home/www/htdocs/aaa and /home/www/htdocs/bbb. For testing convenience, we have placed two index.html files with different content in the subdirectories, and we have modified the permission of the two directories and subdirectories to www:www.Refer to command:
chown www:www -R /home/www/htdocs
Modify the httpd.conf configuration file to activate virtual nodes. Detailed steps are as follows:
As shown in the preceding figure, move the cursor to the start of the row in the red box,enter x and delete ＃, as shown in the following figure:
Include conf/extra/httpd-vhosts.confand then move to the start of ProxyPassMatch, and add # in the front (comment out this row).At last, modify the two corresponding rows as follows:
#ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/home/www/logs/php-fpm.sock|fcgi://127.
Press shift+, enter x!, and then press the Return key to complete modification on the file.Modify the
httpd-vhosts.conf configuration fileAdd # in front of the rows in the red box (comment out these rows), and add the following two nodes to the end.
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/home/www/logs/php-fpm.sock|fcgi://127.0.0.1/home/www/htdocs/aaa/
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/home/www/logs/php-fpm.sock|fcgi://127.0.0.1/home/www/htdocs/bbb/
Press shift+, enter w!, save and exit, as shown in the following figure.
Restart Apache, the command is as follows:
Finally, test the access