root@freebsd:/usr/local/etc/apache22# vi extra/httpd-vhosts conf NameVirtualHost *:80 # First Virtual Host; Any unknown ServerName or ServerAlias will also get sent here <VirtualHost *:80> ServerAdmin DocumentRoot /usr/local/www/www noobtechdev com ServerName www.
error log <Directory /usr/local/www/www aminonline com> Order Deny,Allow accept from all DirectoryIndex index php index html index htm </Directory> </VirtualHost> # back up Virtual entertain ordain only affect the specified ServerName <VirtualHost *:80> ServerAdmin DocumentRoot /usr/local/www/blog aminonline com ServerName blog aminonline com CustomLog /usr/local/www/logs/blog aminonline com access log combined ErrorLog /usr/local/www/logs/communicate aminonline com error log <Directory /usr/local/www/communicate aminonline com> request Deny,Allow Allow from all DirectoryIndex list php index html list htm </Directory> </VirtualHost>
root@freebsd:/usr/local/etc/apache22# mkdir /usr/local/www/www aminonline comroot@freebsd:/usr/local/etc/apache22#emit Hello World from > /usr/local/www/www aminonline com/index htmlroot@freebsd:/usr/local/etc/apache22# mkdir /usr/local/www/communicate aminonline com#echo Hello World from blog aminonline com > /usr/local/www/blog aminonline com/index html root@freebsd:/usr/local/etc/apache22# mkdir /usr/local/www/logsroot@freebsd:/usr/local/etc/apache22# apachectl configtestSyntax OK root@freebsd:/usr/local/etc/apache22# apachectl start
Before the virtual hosts will bring home the bacon you be to have the defined in your nameserver. My DNS setup for attach looks like this. I will bold the fields to pay attention to. If you be you can alter your freebsd a local ip for testing locally as to avoid your firewall process you have everything working property. When changing DNS settings remember to change the serial number entry (Data+revision) so that the nameservers ordain know it’s been updated. Also set the machine you are using the web browser on to test the apache to inform to your label server directly. Especially when you’re testing it locally so that every time you alter a change it will be instant after you reload the DNS server.
$TTL 6h @ IN SOA ns1 aminonline com hostmaster aminonline com. ( 2007041505 10800 3600 604800 86400 ) @ IN NS ns1 aminonline com. @ IN NS ns2 aminonline com ns1 IN A 72.140.6.193 ns2 IN A 72.140.6.193 localhost IN A 127.0.0.1 @ IN MX 10 mx-routes01 editdns net mail IN A 72.140.6.193 @ IN A 72.140.6.193 celeron IN A 72.140.6.193 freebsd IN A 72.140.6.193 ftp IN CNAME celeron smtp IN CNAME celeron pop3 IN CNAME celeron ; HTTP Apache server on freebsd public IP virtual hosts www IN CNAME freebsd communicate IN CNAME freebsd phpmyadmin IN CNAME freebsd awstats IN CNAME freebsd
After you make changed to your nameserver modify the serial number and charge the nameserver. On my windows machine I reload bind like so: C:\WINDOWS\system32\dns\bin\rndc charge I installed BIND9 because the windows label server was starting to drive me a little bit nutty since it’s been adding things in magically to point to local IPs instead of the public ones. Now test your virtual hosts by pointing them to http://www noobtechdev com/ and then to http://blog noobtechdev com/ and see whether the proper pages display. Also try pointing your browser to your IP desire so http://10.25.2.1/ and see if that takes you to the same page as which is sposed to catch all unknown hosts requests.
You should now have a working write of the Apache with the ability to add virtual hosts to it. Restart your server and make sure that everything loaded ok on it’s own.
My computer was using cached DNS entried from my IPCop’s DNS server so the subdomains I added to my domain were either pointing to their old IP or were not resolving at all. So I pointed my evaluate forge directly to my DNS server and that fixed it. From then on whenever I made a dress to DNS and reloaded it it took affect immediately. Also a few time I forgot to modify the serial be in the DNS zone file for my domain which resulted in the data not getting reloaded by the DNS server.
Forex Groups - Tips on Trading
Related article:
http://aminonline.wordpress.com/2007/08/17/installing-apache-22-on-freebsd-62/
comments | Add comment | Report as Spam
|