Default site, if a user goes to your ip address?

16 posts / 0 new
Last post
#1 Sun, 06/21/2009 - 16:19
pcm2a

Default site, if a user goes to your ip address?

I have set up two virtual hosts, that both work great. If I try to go to http://ip_address instead of a domain name, it takes me to one of the two sites. As luck would obviously have it, it's not to the one I want it to go to.

I found something through some searches that there is a "default" flag somewhere that I need to set on the domain that will be the default. Any tips on where this is, or how to set the default domain name?

Sun, 06/21/2009 - 16:42
andreychek

Howdy,

It's in Server Configuration -> Website Options -> "Default website for IP address". -Eric

Sun, 06/21/2009 - 21:03
pcm2a

Still can't find it. Your version might be idfferent than mine or the pay version that looks different?

If I select my domain in Virtualmin, on the right I have a selection called Server Configuration, but under it is not anything called Website Options.

Under Services, I have one called Configure Website and under it is some options that "seem" like they could be right. One block says Virtual Server Details and Address can be set to Default server, Any, or my internal ip. I tried Default server but it did not change anything.

Thanks!

Sun, 06/21/2009 - 22:14 (Reply to #3)
andreychek

Hmm -- what version of Virtualmin are you using? I would have expected all that to be in the GPL version, but the default website options were added 2, maybe 3 versions ago. If you're using an older version, that could be the problem. -Eric

Sun, 06/21/2009 - 22:38
pcm2a

Installed brand new two days ago for the first time. It says virtualmin 3.69 gpl and webmin 1.48.

Mon, 06/22/2009 - 17:48 (Reply to #5)
andreychek

Okay -- so, Jamie is reminding me that this particular feature only shows up if you're the master admin.

Are you logging in as root when you're doing all this? -Eric

Mon, 06/22/2009 - 18:16
pcm2a

Yeah, I am logged in as root. Here is a screenshot of what I see: http://img35.picoodle.com/img/img35/2/6/22/pcm2a/f_virtualminm_f7bf5fe.jpg

On the left I have selected the domain that I am wanting to be the primary. Also on the left I have expanded Server Configuration so you can see my options. Finally I have expanded Services (also on the left) and clicked Configure Website and you can see my choices from that page on the right hand side.

Mon, 06/22/2009 - 18:22
ronald
ronald's picture

there is no such website options in the GPL version. What you can do is to list the default site as the first one in your httpd.conf ( < virtualhos t> container ) in Centos.

In debian it is different, something to do with 000default-site. This Eric can explain better, but it is also explained in this forum somewhere.

Mon, 06/22/2009 - 19:55
pcm2a

Thanks, I'll keep an eye out for some info as I search around for that. I had previously looked at that 000default file in /etc/apache2/sites-enabled/ it starts off with: NameVirtualHost * NameVirtualHost 192.168.10.26:80 ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>

I didn't try to start tinkering with it though.

Mon, 06/22/2009 - 21:32
pcm2a

I found one thing that seems to work, but will have some bad side effects. I took the contents of the domain that I want to be the default "/etc/apache2/sites-available/domain.com.conf" and I pasted the section onto the end of "/etc/apache2/sites-available/default".

The bad side effect is any changes made in virtualmin that will automatically rewrite /etc/apache2/sites-available/domain.com will never get those changes over into "default".

Let me know of any better way than this!

Mon, 06/22/2009 - 21:53 (Reply to #10)
andreychek

Yeah, all the files are read in alphabetical order -- so the key is to make sure the domain you want as the default shows up first. Which is what you're doing there, essentially.

Jamie was talking about maybe moving some of that stuff into the GPL version for selecting a default, but it'll be a few days or weeks before the next version comes out. -Eric

Tue, 06/23/2009 - 09:48
ronald
ronald's picture

/etc/apache2/sites-enabled/ it starts off with: NameVirtualHost * NameVirtualHost 192.168.10.26:80 ServerAdmin

The "NameVirtualhost *" is a problem. you'll want that out and leave the NameVirtualHost 192.168.10.26:80 in.

Tue, 06/23/2009 - 12:33
pcm2a

I'll try putting the file back to "stock" and will remove that one line and see how it affects anything. I'll report back this evening with the results.

My setup is a brand new Ubuntu 8.04 server installation. The only package I had installed prior was ssh. I used the install.sh script to install Virtualmin. I would assume that if it shouldn't have been in the file that Virtualmin would/should have taken care of it during the install?

Tue, 06/23/2009 - 17:20
ronald
ronald's picture

you install virtualmin and it will install the packages you need for hosting websites.

but a system is nothing without a system administrator, meaning you have to arrange your settings and finetune it. During install virtualmin will know a lot of things already though, but it's up to you to make everything work the way you want it to work.

Also serving sites is an Apache thing. The "default" site is not a concept in Apache once you create your first server, it just serves up the first available site it comes along. Which site that is, you will decide.

In Centos one would edit the < virtualhost > containers and put the "default" site first in the list. With Debian its slighty different, but I don't know debian well enough to give exact advice.

Wed, 06/24/2009 - 21:52
pcm2a

I went in and changed my /etc/apache2/sites-available/default (000default) top to: NameVirtualHost 192.168.10.26:80 ServerName 192.168.10.26

So pretty much anything coming in without a domain name is getting this. The only bummer is any specific changes I guess would need to be made by hand to this file, and not through Virtualmin. No big deal though.

Now I can have any users go to http://ip.address/phpmyadmin/ for database stuff instead of forcing that Alias on all domains.

If the "default" option ever makes it into the GPL version I'll definitly switch over to using that option.

My next goal is to make the /phpmyadmin/ accessible only by https instead! I love it.

Mon, 07/27/2009 - 00:02
RenatoMN

I found a way in GPL edition!

I'm using it in Brazilian Portuguese, so the menu and icon names may differ slightly in English.

Go to Webmin menu view, click Servers > Apache Web Server.You will see a 3 tabs screen (the active tab is the 2nd). Click on the first ("Global configuration") and then on "Edit Config Files" icon (the last). It will open the editor on httpd.conf by default (/etc/httpd/conf/httpd.conf).

Start scrolling from end to begin (it will be a lot easier), and you find the last commented lines are:

[blockcode]#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#[/blockcode]

Below this, you will find all your <VirtualHost IP:PORT> sections. Find the one you want as default (to be shown when somebody go to http://your_server_ip/), cut the entire VirtualHost directive (from <VirtualHost IP:PORT> to </VirtualHost>) and paste it right after the example given. Be careful, there is no empty lines between each VirtualHost nor after the last line of the example I pasted here.

Save it. You will be redirected to the 2nd tab ("Existing virtual hosts"). Click "Apply changes" at the tp right corner. You will instantly see the magic: the VirtualHosts list's will be reordered, accordingly to httpd.conf file and (your default website will be the first. If you made it right, of course...).

Regards,
Renato Frota

Topic locked