Nginx and subdomains (and dyndns)

Hi list,

Has anyone setup a server running Nginx and subdomains?

Currently my test server on a dynami IP has a domain at DynDns it is
something like: mysite.ath.cx

What I am trying to do is have subdomains/virtualhosts with Nginx only
listening on port 80 and redirecting where it needs to go.

For instance, Phpmyadmin should appear when typing:
http://phpmyadmin.mysite.ath.cx.

And Punbb:
http://punbb.mysite.ath.cx

And obviously my main website is located at:
http://mysite.ath.cx

The problem is that currently, whathever I type like:
http://whatever.mysite.ath.cx
it is always the main website that appears.

If I type http://phpmyadmin.mysite.ath.cx, it is still the main website
that appears.

For the main site, I have currently:
server_name mysite.ath.cx

And for Phpmyadmin:
server_name phpmyadmin.localhost
(phpmyadmin.mysite.ath.cx didn’t work)

And for PunBB:
server_name punbb.localhost

but this doesn’t do the trick.

So how to define the virtualhosts? Are there any other file to check?

Best regards,

Have you looked at the examples on the Wiki?
http://wiki.codemongers.com/NginxVirtualHostExample

what do you mean phpmyadmin.mysite.ath.cx didn’t work?

-Liang

kingler wrote:

what do you mean phpmyadmin.mysite.ath.cx didn’t work?

What an idiot I am! I wasn’t paying enough attention to the error
message spit by nginx when testing the configuration file.

I simply had to increase server_names_hash_bucket_size to 64, because as
Igor said in another topic, if one of the server_name is longer than 27
chars (or something like that), then you need to do so.

Thanks for asking me why it didn’t work.

I still have a little iffty nifty problem:

I am using the Citadel mail server. It has a web application that can be
accessed securely or not. I’d like to access securely. When I setup the
SSL way, I get the following error message:
“No required SSL certificate was sent”

When directly accessing the secure interface without passing through
nginx it works. Accessing it using regular http work through nginx.

I have Monit with its secure web interface and going through nginx, I
get the SSL certificate and can login with no problem.

Concerning Citadel, whose fault is it? Nginx? Citadel? Both?

Best regards,

The Citadel issue is fixed. That was a pretty nasty one.

In the proxy_pass, I had to specify https for Citadel, and http for
Monit.

Cheers,

You must be have a functional DNS servers in your server.!

Regards.

On Wed, Mar 12, 2008 at 5:22 AM, Fernando P. [email protected]

Actually you don’t even need one.

Simply define a virtualhost as: server_name subdomain.mysite.ath.cx;

And that’s it. Now point firefox to http://subdomain.mysite.ath.cx and
enjoy your website :slight_smile:

But for the LAN (i.e: directly access the website even if the DSL
cable is unplugged), I don’t exactly know how to do, I think in this
case a DNS server is required.