Quantcast
Channel: openSUSE Forums
Viewing all articles
Browse latest Browse all 40713

OS 13.1 - Apache 2.4.6 - VHOSTS config questions

$
0
0
hello.
I plan to create a web server which is installed for the moment on local network.
I am using apache 2.4.6 on opensuse 13.1
I want to use name based virtual hosts.

There is no dns server

After reading a lot, i have found that the definition and the use for
NameVirtualHost
VirtualHost
ServerName
ServerAlias
ServerPath
are not very clear for me.

Here is my config.

On the web server (192.168.130.100)
===================================

/etc/resolv.conf file is configured as :
++++++++++++++++++++++++++++++++++

Code:

search lan
nameserver 192.168.1360.230

/etc/hosts file is configured as :
++++++++++++++++++++++++++++++++++

Code:

192.168.130.100    LINUX-TEST-123.my-dom.nwk    LINUX-TEST-123
#
# LOCAL
127.0.0.1            localhost.localdomain        localhost
# ------------ PROJECT 1
127.0.0.1            project_1.my-dom.nwk        project_1
# ------------ PROJECT 1
127.0.0.1            project_2.my-dom.nwk        project_2
#

/etc/sysconfig contains :
+++++++++++++++++++++++++

Code:

APACHE_CONF_INCLUDE_FILES="/etc/apache2/httpd.local.conf"
/etc/apache2/httpd.local.conf contains :
++++++++++++++++++++++++++++++++++++++++

Code:

<Directory /srv/www/htdocs>
    Options +FollowSymLinks
</Directory>

IncludeOptional /etc/apache2/my_virtual_hosts/*.conf

/etc/listen.conf
++++++++++++++++

Code:

Listen 80


<IfDefine SSL>
    <IfDefine !NOSSL>
    <IfModule mod_ssl.c>

        Listen 443

    </IfModule>
    </IfDefine>
</IfDefine>


# Use name-based virtual hosting
NameVirtualHost *:80

/etc/apache2/my_virtual_hosts/project_1.conf contains :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Code:

<VirtualHost *:80>
    ServerAdmin root@LINUX-TEST-123.hathor-nwk
    ServerName  ?????????????????
    ServerAlias ?????????????????

    # symbolic links
    DocumentRoot /srv/www/htdocs/PROJECT_1

    # if not specified, the global error log is used
    ErrorLog  /var/log/apache2/PROJECT_1-error_log
    CustomLog /var/log/apache2/PROJECT_1-access_log  combined

    # don't loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On

    #
    <IfModule mod_userdir.c>
    UserDir public_html
    Include /etc/apache2/mod_userdir.conf
    </IfModule>

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/srv/www/htdocs/PROJECT_1">

        Options Indexes FollowSymLinks

#        AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
        Allow from all

    </Directory>

</VirtualHost>

Physically, data are kept on /data1_pub/400_SERVEUR_WEB/PROJECT_1/001_keep_final_ok/public_html/

a link is created in /srv/www/htdocs/WEB_1

/etc/apache2/my_virtual_hosts/project_2.conf contains :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Code:

<VirtualHost *:80>
    ServerAdmin root@LINUX-TEST-123.hathor-nwk
    ServerName  ?????????????????
    ServerAlias ?????????????????

    # symbolic links
    DocumentRoot ?????????????????

    # if not specified, the global error log is used
    ErrorLog  /var/log/apache2/PROJECT_2-error_log
    CustomLog /var/log/apache2/PROJECT_2-access_log  combined

    # don't loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On

    #
    <IfModule mod_userdir.c>
        UserDir public_html
        Include /etc/apache2/mod_userdir.conf
    </IfModule>

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/srv/www/htdocs/PROJECT_2">

        Options Indexes FollowSymLinks

#        AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
        Allow from all

    </Directory>

</VirtualHost>

Physically, data are kept on /data1_pub/400_SERVEUR_WEB/PROJECT_2/001_keep_final_ok/public_html/

a link is created in /srv/www/htdocs/WEB_2

/etc/apache2/default-vhost.conf contains :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Code:

EMPTY
/etc/apache2/default-server.conf contains :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Code:

(Left unmodified)

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
    Options None
#    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

<Directory "/srv/www/cgi-bin">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
</Directory>

#
<IfModule mod_userdir.c>
    UserDir public_html
    Include /etc/apache2/mod_userdir.conf
</IfModule>

#
IncludeOptional /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
IncludeOptional /etc/apache2/conf.d/apache2-manual?conf

On a client linux box
===================================

/etc/resolv.conf file is configured as :
++++++++++++++++++++++++++++++++++

Code:

search lan
nameserver 192.168.1360.230

/etc/hosts file is configured as :
++++++++++++++++++++++++++++++++++

Code:

# LOCAL
127.0.0.1            localhost.localdomain        localhost
# MY NETWORK
192.168.130.100    LINUX-TEST-123.my-dom.nwk    LINUX-TEST-123


I have a few questions.

I want users getting access by these address from the local network

http://my-dom.nwk/web_1 or web_1
and
http://my-dom.nwk/web_2 or web_2

From internet when I will setup my domain through OpenDNS
http://my-dom.nwk/web_1
and
http://my-dom.nwk/web_2

What should I put in the /etc/hosts on a client soandshoulde be resolved

What should I put in /etc/apache2/my_virtual_hosts/project_1.conf and /etc/apache2/my_virtual_hosts/project_2.conf for
ServerName ?????????????????
ServerAlias ?????????????????
DocumentRoot ?????????????????
<Directory "/srv/www/htdocs/??????????">

Where to configure a default VHOSTS so I show a web page error if a bad web server project is specified. ( there are VHOSTS configured in /etc/apache2/my_virtual_hosts )

What name should be written in upper case or lower case letters accordingly
with physical location on disks or definitions in files ?
Any help is welcome.

Viewing all articles
Browse latest Browse all 40713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>