# Separate servers on localhost?

## kbzium

Hello,

I have couple of projects that need to be launched on different servers (one uses PHP, other Python etc.). The thing is I don't want to mix everything up. Is there a simple way to create some totally independent clones of localhost? It might be done via subdomaining?

project1.localhost - launches server 1 with homedir /home/user/Projects/project1 with PHP, MySQL etc. enabled

project2.localhost - launches server 2 with homedir /home/user/Projects/project2 with Python, PL-SQL etc. enabled

I don't want to lose myphpadmin as well - it could be common for all those servers.

What would be the easiest, most flexible solution to this problem?

Thanks!

----------

## Ant P.

Just set them up as FastCGI normally and have the webserver choose the right one based on the hostname.

----------

## kbzium

Actually I think I might be near solving this problem. I know that your solution would work, but I'd like to try something else too  :Smile: . You know, when it comes to set up a real server it might come in handy.

When I type in name1.proj in web browser apache seem to recognize it, but somehow I get error 403:

"You don't have permission to access / on this server."

How is that? A folder that is a root directory is in apache group...

Current config:

httpd

```
ServerRoot "/usr/lib64/apache2"

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_dbm_module modules/mod_authn_dbm.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

<IfDefine AUTHNZ_LDAP>

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

</IfDefine>

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_fs_module modules/mod_dav_fs.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_lock_module modules/mod_dav_lock.so

</IfDefine>

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

<IfDefine CACHE>

LoadModule disk_cache_module modules/mod_disk_cache.so

</IfDefine>

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

<IfDefine CACHE>

LoadModule file_cache_module modules/mod_file_cache.so

</IfDefine>

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

<IfDefine LDAP>

LoadModule ldap_module modules/mod_ldap.so

</IfDefine>

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

<IfDefine CACHE>

LoadModule mem_cache_module modules/mod_mem_cache.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

User apache

Group apache

Include /etc/apache2/modules.d/*.conf

 

 # Virtual-host support 

Listen 80

NameVirtualHost *:80

Include /etc/apache2/vhosts.d/*.conf

```

One of the servers:

```
<VirtualHost *:80>

       ServerName test1.proj

       DocumentRoot "/mnt/magazyn/Projekty/test1/www"

       <Directory "/mnt/magazyn/Projekty/test1/www">

               Options Indexes FollowSymLinks

               AllowOverride All

               Order allow,deny

               Allow from all

       </Directory>

</VirtualHost>

```

What to do?

----------

## kbzium

It works!

But! Why all the parent dirs MUST have 775 rights? It doesn't seem safe.

----------

## cach0rr0

 *kbzium wrote:*   

> It works!
> 
> But! Why all the parent dirs MUST have 775 rights? It doesn't seem safe.

 

sure that's not 755? 

Normally: directories 755, files 644 (rule of thumb)

----------

