VirtualHostingas: konfigūravimas, CentOS
Veiksmas vyksta CentOS. Virtualius domenus man patogiau laikyti atskiruose failuose, atskiroje direktorijoje. Sukurkime ją:
#sudo mkdir /etc/httpd/conf/vhosts
dabar pakoreguojame httpd konfigūraciją:
#sudo nano /etc/httpd/conf/httpd.conf
ir pabaigoje failo pridedame:
Include conf/vhosts/*.conf
Dabar sukuriame domeną:
sudo nano /etc/httpd/conf/vhosts/domain1.com.conf
Įrašome vhost konfigūraciją, pvz:
# Place any notes or comments you have here # It will make any customization easier to understand in the weeks to come # domain: domain1.com # public: /home/demo/public_html/domain1.com/ <VirtualHost *:80> # Admin email, Server Name (domain name) and any aliases ServerAdmin [email protected] ServerName www.domain1.com ServerAlias domain1.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html DocumentRoot /home/demo/public_html/domain1.com/public # Custom log file locations LogLevel warn ErrorLog /home/demo/public_html/domain1.com/log/error.log CustomLog /home/demo/public_html/domain1.com/log/access.log combined </VirtualHost>
Kad įsigaliotų nustatymai, perkrauname:
sudo /usr/sbin/apachectl graceful
paskutinis žingsnis, koreguojame „/etc/hosts“ failą, pvz:
127.0.0.1 localhost ... # entries related to the demo slice 123.45.67.890 domain1.com 123.45.67.890 www.domain1.com 123.45.67.890 domain2.com ...
Viskas.