Avatar billede doomstone-dk- Nybegynder
14. september 2003 - 23:01 Der er 21 kommentarer og
1 løsning

Vhost virker ikke

Hvordan skal min config se ud hvis jeg vil have alle sub domaner der ikke hedder ask.03x.dk til at fore til /var/www/html/
og hvis den hedder ask.03x.dk skal den gaa til /var/www/afk/

Har sidet heledagen men kan sq ikke finde ud af det :(
Køre linux mandrake hvis der er nogen forskel med det?
Avatar billede doomstone-dk- Nybegynder
14. september 2003 - 23:02 #1
min server locale ip er 192.168.1.4
Avatar billede simonvalter Praktikant
14. september 2003 - 23:20 #2
Listen 192.168.1.4:80
BindAddress 192.168.1.4
Port 80
NameVirtualHost 192.168.1.4

<VirtualHost 192.168.1.4>
        ServerName 03x.dk
        ServerAlias www.03x.dk
        ServerAdmin mail@03x.dk
        DocumentRoot /var/www/htm
        ErrorDocument 404 /missing.html
        ErrorLog /var/log/03x.dk-error_log
        CustomLog /var/log/03x.dk-access_log common
</VirtualHost>

<VirtualHost 192.168.1.4>
        ServerName ask.03x.dk
        ServerAdmin ask@03x.dk
        DocumentRoot /var/www/afk
        ErrorDocument 404 /missing.html
        ErrorLog /var/log/ask.03x.dk-error_log
        CustomLog /var/log/ask.03x.dk-access_log common
</VirtualHost>

burde virke
Avatar billede simonvalter Praktikant
14. september 2003 - 23:23 #3
og så burde din dns's
cname være sat op til at bruge stjerne alias

cname *.03x.dk 03x.dk
Avatar billede simonvalter Praktikant
14. september 2003 - 23:24 #4
nu ved jeg selvfølgelig ikke om du har adgang til din dns .. men hvis du feks køber domaine eller flytter til http://gratisdns.dk så får du fuld kontrol over din dns.
Avatar billede doomstone-dk- Nybegynder
14. september 2003 - 23:29 #5
Hmm nu hvor jeg går ind på min web server giemmen http://192.168.1.4/ siger den

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

Nu
Avatar billede simonvalter Praktikant
14. september 2003 - 23:32 #6
du har bel en index. fil liggende i / ?
Avatar billede simonvalter Praktikant
14. september 2003 - 23:32 #7
bel/vel
Avatar billede doomstone-dk- Nybegynder
14. september 2003 - 23:41 #8
hmm ja der ligger en index.html i /var/www/afk og en index.php i /var/www/html
Avatar billede simonvalter Praktikant
14. september 2003 - 23:51 #9
ja så ved jeg det ikke .. jeg bruger samme opsætning og det virker fint her
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 20:14 #10
Hmm fandt fejlen
DocumentRoot /var/www/htm
DocumentRoot /var/www/html <-- rigtig

Så nu kan jeg godt komme ind på siden men når jeg går igen gemmen ask.03x.dk så bliver jeg bare henvist til 03x.dk
Avatar billede simonvalter Praktikant
17. september 2003 - 20:57 #11
hmm .. paste mig din config eller ligge et link til den så jeg kan gennemse den .. det virker lidt mærkeligt at det ikke virker ..
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 21:07 #12
/etc/httpd/2.0/conf/httpd2.conf
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/html


### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module                modules/mod_access.so
LoadModule auth_module                  modules/mod_auth.so
LoadModule auth_anon_module              modules/mod_auth_anon.so
##LoadModule auth_dbm_module              modules/mod_auth_dbm.so
LoadModule auth_digest_module            modules/mod_auth_digest.so
LoadModule include_module                modules/mod_include.so
LoadModule log_config_module            modules/mod_log_config.so
LoadModule env_module                    modules/mod_env.so
##LoadModule mime_magic_module            modules/mod_mime_magic.so
##LoadModule cern_meta_module            modules/mod_cern_meta.so
LoadModule expires_module                modules/mod_expires.so
LoadModule headers_module                modules/mod_headers.so
LoadModule usertrack_module              modules/mod_usertrack.so
##LoadModule unique_id_module            modules/mod_unique_id.so
LoadModule setenvif_module              modules/mod_setenvif.so
LoadModule proxy_module                  modules/mod_proxy.so
##LoadModule proxy_connect_module        modules/mod_proxy_connect.so
##LoadModule proxy_ftp_module            modules/mod_proxy_ftp.so
LoadModule proxy_http_module            modules/mod_proxy_http.so
LoadModule mime_module                  modules/mod_mime.so
LoadModule status_module                modules/mod_status.so
LoadModule autoindex_module              modules/mod_autoindex.so
LoadModule asis_module                  modules/mod_asis.so
LoadModule info_module                  modules/mod_info.so
LoadModule cgi_module                    modules/mod_cgi.so
##LoadModule cgid_module                  modules/mod_cgid.so
LoadModule vhost_alias_module            modules/mod_vhost_alias.so
LoadModule negotiation_module            modules/mod_negotiation.so
LoadModule dir_module                    modules/mod_dir.so
LoadModule imap_module                  modules/mod_imap.so
LoadModule actions_module                modules/mod_actions.so
##LoadModule speling_module              modules/mod_speling.so
LoadModule userdir_module                modules/mod_userdir.so
LoadModule alias_module                  modules/mod_alias.so
LoadModule rewrite_module                modules/mod_rewrite.so

##New Modules for 2.0 (some are experimental)
##LoadModule file_cache_module          modules/mod_file_cache.so
##LoadModule echo_module                modules/mod_echo.so
##LoadModule charset_lite_module        modules/mod_charset_lite.so
##LoadModule cache_module                modules/mod_cache.so
##LoadModule disk_cache_module          modules/mod_disk_cache.so
##LoadModule mem_cache_module            modules/mod_mem_cache.so
##LoadModule ext_filter_module          modules/mod_ext_filter.so
##LoadModule case_filter_module          modules/mod_case_filter.so
##LoadModule case_filter_in_module      modules/mod_case_filter_in.so
##LoadModule deflate_module              modules/mod_deflate.so
##LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
##LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
##LoadModule optional_fn_import_module  modules/mod_optional_fn_import.so
##LoadModule optional_fn_export_module  modules/mod_optional_fn_export.so
##LoadModule bucketeer_module            modules/mod_bucketeer.so
##LoadModule logio_module                modules/mod_logio.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
# For Apache2 we load all conf files in conf.d
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the
# cgi or php files

#BindAddress *
<IfDefine APACHEPROXIED>
    Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
    Listen 80
</IfDefine>

# Likewise, we can set apache as the server by default and send perl
# requests via ProxyPass to apache-mod_perl. It increases performance
# since the perl interpreter is only used for perl and the standard apache
# does all the html and image files, with a smaller footprint.
#
# If you install apache and apache-mod_perl, this is the default config.
# If you don't want two web servers to use perl, uninstall apache, and
# apache-mod_perl will not be proxied.

<IfDefine PERLPROXIED>
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^proxy:.*  -  [F]
    RewriteRule ^(.*\/perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
    RewriteRule ^(.*\/cgi-perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
</IfModule>
</IfDefine>

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
Include conf/vhosts/DynamicVhosts.conf
Include conf/vhosts/VirtualHomePages.conf


###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15


# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers        5
MinSpareServers      5
MaxSpareServers    10
MaxClients        150
MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers        2
MaxClients        150
MinSpareThreads    25
MaxSpareThreads    75
ThreadsPerChild    25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers          5
StartThreads        5
MinSpareThreads      5
MaxSpareThreads    10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>

/etc/httpd/2.0/conf/vhosts/Vhosts.conf
################# Vhosts.conf
#This is where we store the VirtualHosts configuration.
#
#Since Apache 1.3.19, we modified the setup to include some nice tricks:
#
#- We added the User and Group directives so VirtualHosts now work with
#  suexec directive. If set, Apache will run all cgi scripts under that
#  user and group (provided the uid and gid are > 100 for security). The
#  directories and cgi files *must* belong to that user/group for the
#  feature to work
#- We added the Setenv VLOG directive. This works in conjunction with
#  the CustomLog in common.conf. When Setenv VLOG is set, apache will
#  create a /var/log/httpd/VLOG-YYYY-MM-<ServerName>.log instead of logging
#  to access_log. Use this instead of defining a special logfile for
#  each vhost, otherwise you eat up file descriptors.
#- You can also specify a path for the VLOG for each Vhost, for example,
#  to place the logs in each user's directory. However, if you want to
#  use the file for accounting, place it in a directory owned by root,
#  otherwise the user will be able to erase it.
#- I suggest only including the ErrorLog *only* if the vhost will use
#  cgi scripts. Again, it saves file descriptors!
#- We added the Rewrite directives so vhosts will work with the
#  PERLPROXIED configuration


################# IP-based Virtual Hosts
#<VirtualHost 192.168.2.100>
#User jmdault
#Group jmdault
#DocumentRoot /home/jmdault/public_html
#ServerName test2.com
#Setenv VLOG /home/jmdault/logs
#ErrorLogs /home/jmdault/test2-error_log
#RewriteEngine On
#RewriteOptions inherit
#</VirtualHost>

################# Named VirtualHosts
#NameVirtualHost 111.222.33.44
#<VirtualHost 111.222.33.44>
#ServerName www.domain.tld
#ServerPath /domain
#DocumentRoot /web/domain
#</VirtualHost>

NameVirtualHost 192.168.1.4

<VirtualHost 192.168.1.4>
ServerName 03x.dk
ServerAlias www.03x.dk
ServerAdmin info@doomstone.dk
DocumentRoot /var/www/html
ErrorDocument 404 /missing.html
ErrorLog /var/log/03x.dk-error_log
CustomLog /var/log/03x.dk-access_log common
</VirtualHost>

<VirtualHost 192.168.1.4>
ServerName 03b.03x.dk
ServerAdmin info@doomstone.dk
DocumentRoot /var/www/03b
ErrorDocument 404 /missing.html
ErrorLog /var/log/03b.03x.dk-error_log
CustomLog /var/log/03b.03x.dk-access_log common
</VirtualHost>
Avatar billede simonvalter Praktikant
17. september 2003 - 21:10 #13
smid lige dem her ind

Listen 192.168.1.4:80
BindAddress 192.168.1.4
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 21:12 #14
Starting httpd2: Syntax error on line 47 of /etc/httpd/2.0/conf/vhosts/Vhosts.conf:
Invalid command 'BindAddress', perhaps mis-spelled or defined by a module not included in the server configuration
                                                                [FAILED]
Avatar billede simonvalter Praktikant
17. september 2003 - 21:13 #15
ok .. troede også bindadress var et apache2 entry
Avatar billede simonvalter Praktikant
17. september 2003 - 21:14 #16
prøv så bare at sig den kun skal listen så
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 21:16 #17
Starting httpd2: httpd2: Could not determine the server's fully qualified domain name, using 192.168.1.4 for ServerName
(98)Address already in use: make_sock: could not bind to address 192.168.1.4:80
no listening sockets available, shutting down
Unable to open logs

                                                                [FAILED]
:)
Avatar billede simonvalter Praktikant
17. september 2003 - 21:20 #18
så prøv at lave virtualhost om til
<VirtualHost *>

ellers må jeg sq læse lidt mere .. jeg kører selv med 1.3.*
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 21:29 #19
altser
NameVirtualHost *

<VirtualHost *>
ServerName 03x.dk
ServerAlias www.03x.dk
ServerAdmin info@doomstone.dk
DocumentRoot /var/www/html
ErrorDocument 404 /missing.html
ErrorLog /var/log/03x.dk-error_log
CustomLog /var/log/03x.dk-access_log common
</VirtualHost>

<VirtualHost *>
ServerName 03b.03x.dk
ServerAdmin info@doomstone.dk
DocumentRoot /var/www/03b
ErrorDocument 404 /missing.html
ErrorLog /var/log/03b.03x.dk-error_log
CustomLog /var/log/03b.03x.dk-access_log common
</VirtualHost>
Avatar billede simonvalter Praktikant
17. september 2003 - 21:34 #20
jep .. og hvordan virker det?
Avatar billede doomstone-dk- Nybegynder
17. september 2003 - 21:36 #21
Nu siger den noget underligt
http://03b.03x.dk
Avatar billede simonvalter Praktikant
17. september 2003 - 21:43 #22
den lytter på port 443 .. eller så forwarder den til porten

prøv lige at sætte det her ind

Listen 80
over

NameVirtualHost *

check
config filerne i
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf

om der er noget med mod_ssl
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Uanset kodesprog, så giver vi dig mulighederne for at udvikle det, du behøver.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester