- Go to servers.
- Go to Apache WebServer.
- In the 'Create a New Virtual Server' section select "Any Address" (so you do not end up with a hard coded IP addresses in your conf file)
- Enter 80 for Port (and select the last radio button). This way the VirtualHost will co-exist with any SSL-enabled virtual hosts you add later on. SSL-enabled VirtualHosts need to listen on port 443.
- In the "Document Root" field enter where the virtual host HTML files will be. For example, /home/vhostdomain.com/htdocs.
- For "Server Name" enter the domain name for which you want to serve pages. e.g. "vhostdomain.com"
After you have created the Virtual Host, there are a few other things you may wish to edit.
For example, click on the Virtual Host, and go to Networking and Addresses. Enter an "Alternate virtual server names" of *.YourOtherDomain.com
. With this setting, your virtual host will serve pages forhttp://yourotherdomain.com/
as well as http://www.yourotherdomain.com/
.
At this point you may also wish to set other options like "Log Files", so the log files for the Virtual Host end up in separate log file from the main server's log files.
To activate your changes, click "Apply Changes" on the main Apache Webmin page.
Some peoble
problem is it's loading the default site (at /var/www) instead of the virtual one I just created
fixed this by adding directive ServerAlias domain.tld *.domain.tld
You can find this for setup under Apache -> Your Virtual Domain settings -> Networking and Addresses -> Alternate virtual server names FIELD.
domain.tld *.domain.tld
دقت کنید که سروز دیفات وی هاست هایی که میسازیم اورراید نکرده باشه
ورگنه همیشه پوشه دیفالت رو میاره