The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

4.7. Adding your first server

In this section, I will give you a step-by-step tutorial on how to create your first site (virtual server) with Caudium. If you want to do something useful with Caudium, you have to create at least one virtual server. Without this first server, Caudium will not do anything. If you use your browser to access your server, you will only get a dialog box prompting for the CIF. login/password.


A virtual server allows you to have several servers running on the same port. For example you can have and running on the same port and machine. This is why it is called virtual server.

To create your first server, log into the web based CIF.. Click on the Virtual Servers tab, then the button.

Here, you are prompted for the server name:

Type in an easily identifiable name. You also have to select the configuration type. Depending on the configuration you choose, your server will have a different set of modules. In other words, your server will have different capabilities. For your first server, choose Basic server, and click OK.

4.7.1. Server variables

Now you'll see the Virtual Servers page again. As you can see, you have two different folders to work on: Server variables (Figure 4-1) and File system (Figure 4-2).

Server variables contain the URL of your site, and the port on which it will be available. File system describes the files/directories containing the .html and other files you want Caudium to serve.

In server variables, go into Listen ports and choose Configure a new port. Use the default values, choose Use these values, and click . Now select the URL of your site, and select Continue. You can now go back to the page displaying all of your modules, that is, where you were before you had gone into Server Variables.

Under your server name, you'll see the status of your server. If it contains the word "Open" in blue everything is okay, and you can continue with configuring the file system.

If it contains the words "Not open" in red, there is a problem. You can go into the Event Log via the CIF. tab to investigate. If you have an error Failed to open socket on 0:80 (already bound ?), you may have another program or Caudium itself already running on this port. To fix the problem, identify the program which is using this port, and restart Caudium [1]. To restart Caudium, go into Action->Shutdown->Shutdown Caudium->Restart Caudium. Wait a few seconds, and when prompted, select Virtual Servers. Now select your server, and you should have the word "Open" in blue.

NoteIn the CIF. you may wonder what are those two different protocols http and http2?

The difference is that http2 uses Caudium's internal memory cache while http is plain Pike http subsystem. So http2 is faster than http as you might expect. However, there are some issues on some specific sites.

4.7.2. Selecting file system

By selecting a file system, you tell Caudium which files it will send to people browsing your site. For those who know other web servers, please pay close attention to these explanations, because Caudium is quite different from other servers in this respect.

Caudium file systems use the Unix philosophy of mount point, rather than c:, d:, and so forth. The mount point concept allows you to put your files/directory under any URL you want without changing the files on your local file system. For example, assume you have the following local file system:

And suppose your URL is

With a default configuration, you would say that points to /home/ so that you will have customer1 under, bertrand under and bigcustomer3 under

But bigcustomer3 gives you a lot of money and he asks you for an URL such as However, he doesn't want to be moved from /home/customers/bigcustomer3 because of his FTP client's configuration. Moreover, you can't move the other accounts. With the mount point philosophy, you just have to create another mount point saying that /home/customers/bigcustomer3 is mounted on /bigcustomer3 so that when someone uses, Caudium will serve them files from /home/customers/bigcustomer3.

Now let's return to our setup. Go into the File System module, and select NONE/ mounted on / -> Path -> Search Path. Here you will decide which of your directories will be available when someone hits the root of your server. Write, for example, /home.

You can now launch your favorite browser to the URL of your site and enjoy.

If you don't want visitors to get a listing of your files for security reasons, you can disable listing by setting Directory Settings -> Enable directory listing per default to No. Next you have to hit the More options button, and then reload the module. Don't forget to click Save. It is possible to put one of two "magic files" in any directory to make it browsable/not browsable despite the setting in the CIF. for that particular file system:

.www_browsable - the directory will always be browsable
.www_not_browsable - the directory will never be browsable

Finally, to allow bigcustomer3 to get to his URL, go to File System -> Copy Module. Next, go to Path -> Search Path and type /home/customers/bigcustomer3, then type /bigcustomer3 in Mount point.

The Figure 4-3 shows the output you should have.


If you created these files/directories after you point Caudium to your site, it is safe to go in the Actions tab, then to Cache -> Cache status -> Flush caches.

4.7.3. Creating a virtual server

A web server is usually running on a single port and on a single IP address. So how can someone have different sites on this single port and single IP? The solution is to tell Caudium that the server is different based on the URL. This is the task of the Virtual Hosting module. As this module is not present in the Generic template we use, you will have to add it. Just use the Add module button, and click the image named "Virtual Host Matcher".

You are now able to do redirection with the help of regular expressions. If you don't know what regular expressions ("regexp" for short) are, check the man page for regexp, see Pike/Perl manual, or maybe buy a book on regular expressions. To write these redirections based on the URL, go into Regular expression rewrite rules and add the following rule:

Save and type this command on your command line in order to get your browser resolving

# echo "" >> /etc/hosts.

You now have to add another virtual server with the button New Virtual Server at the root of the virtual server tab. Put Virtual host as the server name and choose the Generic server configuration type. Go into Server variables -> Server URL and type You should see:

This server is handled by the port in my first virtual server. Server URL:

Change the file system root and /tmp in File system -> NONE/ mounted on / -> Paths -> Search path.

You can now point your favorite browser to http://localhost/ and and see the result.

If you have an error telling you is unknown check your host file.

For more information about virtual hosting, see the Virtual-Web Mini-HOWTO available at the LDP or in /usr/share/doc/HOWTO or /usr/doc/HOWTO under Debian GNU/Linux.



To identify you can use lsof(8). If you want to know which programs listen on port 80 just issue the following command as root


You need to be root if lsof has been compiled with the HASSECURITY option which is the default for some GNU/Linux distributions


# lsof -i TCP:80

Here is the result:

caudium 1001 root   12u  IPv4   3993       TCP *:www (LISTEN)

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру