|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
[INFO] Apache 2.x e VirtualHost...
Ho 1 piccolo problemino strano KE nn mi è mai successo su apache 1.3.x
Al server d default ho aggiunto 6 VirtualHost (2 veri host e 4 "alias" x i servizi quale webmail, cacti ecc ecc) MA TUTTI continuano a puntarmi alla DocumentRoot del server d default anke se, ovviamente, dentro ogni direttiva <virtualhost> ho aggiunto la DocumentRoot. Un pezzo del mio http.conf è questo : Codice:
<VirtualHost *> ServerName cacti.mydomain.com ServerAdmin postmaster@mydomain.com DocumentRoot /var/www/html/cacti </VirtualHost> <VirtualHost *> ServerName my2domain.com ServerAlias www.my2domain.com DocumentRoot /home/my2domain.com/www ErrorLog /home/my2domain.com/logs/error_log CustomLog /home/my2domain.com/logs/access_log common ScriptAlias /cgi-bin/ /home/my2domain.com/cgi-bin/ <Directory /home/my2domain.com/www> Options Indexes IncludesNOEXEC FollowSymLinks </Directory> </VirtualHost> TNK
__________________
Powered by Apple Macbook Pro Retina |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 5707
|
se non sbaglio per avere dei virtual host basati sul nome devi utilizzare la direttiva NameVirtualHost
|
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Nov 2001
Città: Malmö (Svezia) - Copenhagen
Messaggi: 962
|
in apache2 i virtual hosts non li metti piú nel file http.conf.
Esiste invece un file chiamato vhosts.conf dove inserisci quelle informazioni. Tale file viene poi incluso e controllato da http.conf (che almeno da me si chiama peró httpd2.conf). Se scorri tale file sono certo che trovi la linea relativa e puoi vedere come si chiama esattamente il file vhost.conf che devi modificare... Un modo semplice per modificare e gestire il tutto é utilizzare webmin ![]()
__________________
http://www.francescoinsvezia.net Il mio blog scandinavo! aka "La mia vita fra la gnokka" ![]() ![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Quote:
Puoi postarmi il tuo vhost.conf ? tnk
__________________
Powered by Apple Macbook Pro Retina |
|
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Aggiornamento :
Tramite la direttiva "ServerAlias" sono riuscito a fare andare i vari domini principali (www.dominio1.com www.dominio2.com ecc ecc) MA nn i sottodomini (user1.dominio1.com user2.dominio1.com ecc ecc) nel senso ke dominio1 e dominio2 puntano e mostrano le rispettive DocumentRoot mentre i vari sottodomini mostrano sempre e solo la DocRoot del dominio principale...
__________________
Powered by Apple Macbook Pro Retina |
![]() |
![]() |
![]() |
#6 |
Senior Member
Iscritto dal: Nov 2001
Città: Malmö (Svezia) - Copenhagen
Messaggi: 962
|
Su gentoo httpd.conf si chiama apache2.conf
Codice:
### /etc/apache2/conf/apache2.conf ### $Id: apache2.conf,v 1.1 2004/03/22 21:17:57 stuart Exp $ ### ### Main Configuration Section ### You really shouldn't change these settings unless you're a guru ### ServerRoot /usr/lib/apache2 ServerName francescoinsvezia.net #LockFile /etc/apache2/apache2.lock PidFile /var/run/apache2.pid ErrorLog logs/error_log LogLevel warn DocumentRoot /var/www/localhost/htdocs ### Dynamic Shared Object (DSO) Support ### ### You should always leave these 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 ### # Splitting up apache2.conf into two files makes it easier to support # multiple configurations on the same serer. In commonapache2.conf # you keep directives that apply to all implementations and in this # file you keep server-specific directives. While we don't yet have # multiple configurations out-of-the-box, this allows us to do that # in the future easily. (PERLPROXIED *ahem*) # # For Apache2 we load all conf files in conf/modules.d Include conf/modules.d/*.conf Include conf/commonapache2.conf ### ### IP Address/Port ### #BindAddress * Listen 80 ### ### 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/vhosts.conf, we use this entry #CustomLog "|/usr/sbin/apache2splitlogfile" 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/dynamic-vhosts.conf #Include conf/vhosts/virtual-homepages.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> #NameVirtualHost francescoinsvezia.net #NameVirtualHost www.francescoinsvezia.net #NameVirtualHost dario.francescoinsvezia.net #NameVirtualHost steogen.francescoinsvezia.net ##NameVirtualHost carotanna.francescoinsvezia.net #NameVirtualHost osix.francescoinsvezia.net #NameVirtualHost webmail.francescoinsvezia.net # 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> Codice:
################# 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 francescoinsvezia.net <VirtualHost francescoinsvezia.net> ServerName francescoinsvezia.net ServerPath /var/www/localhost/htdocs/francescoinsvezia DocumentRoot /var/www/localhost/htdocs/francescoinsvezia </VirtualHost> NameVirtualHost www.francescoinsvezia.net <VirtualHost www.francescoinsvezia.net> ServerName www.francescoinsvezia.net ServerPath /var/www/localhost/htdocs/francescoinsvezia DocumentRoot /var/www/localhost/htdocs/francescoinsvezia </VirtualHost> NameVirtualHost steogen.francescoinsvezia.net <VirtualHost steogen.francescoinsvezia.net> DocumentRoot /var/www/localhost/htdocs/steogen ServerName steogen.francescoinsvezia.net ServerPath /var/www/localhost/htdocs/steogen DocumentRoot /var/www/localhost/htdocs/steogen </VirtualHost> NameVirtualHost dario.francescoinsvezia.net <VirtualHost dario.francescoinsvezia.net> DocumentRoot /var/www/localhost/htdocs/dario ServerName dario.francescoinsvezia.net ServerPath /var/www/localhost/htdocs/dario DocumentRoot /var/www/localhost/htdocs/dario </VirtualHost> NameVirtualHost osix.francescoinsvezia.net <VirtualHost osix.francescoinsvezia.net> DocumentRoot /var/www/localhost/htdocs/osix ServerName osix.francescoinsvezia.net ServerPath /var/www/localhost/htdocs/osix DocumentRoot /var/www/localhost/htdocs/osix </VirtualHost> NameVirtualHost webmail.francescoinsvezia.net <VirtualHost webmail.francescoinsvezia.net> ServerName webmail.francescoinsvezia.net ServerPath /var/www/localhost/htdocs/squirrelmail DocumentRoot /var/www/localhost/htdocs/squirrelmail </VirtualHost> Nel mio caso il provider presso cui ho registrato il dominio mi permette di creare illimitati sottodomini, che io gestisco definendoli come CNAME records che puntano a francescoinsvezia.net. (il punto alla fine é importante). Io nel frattempo sto facendo a cazzotti con Courier che non ne vuole sapere di farmi fare l'autenticazione sulle mailbox create da vpopmail ![]()
__________________
http://www.francescoinsvezia.net Il mio blog scandinavo! aka "La mia vita fra la gnokka" ![]() ![]() |
![]() |
![]() |
![]() |
#7 | |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Quote:
Cambiando il httpd.conf ora se faccio "apachectl restart" ottengo questo : Codice:
[warn] NameVirtualHost cacti.mydomain.com:0 has no VirtualHosts [warn] NameVirtualHost www.mydomain2.com:0 has no VirtualHosts [warn] NameVirtualHost webmail.mydomain.com:0 has no VirtualHosts
__________________
Powered by Apple Macbook Pro Retina |
|
![]() |
![]() |
![]() |
#8 |
Senior Member
Iscritto dal: Nov 2001
Città: Malmö (Svezia) - Copenhagen
Messaggi: 962
|
a essere onesto lo fa anche a me... peró poi funziona
![]()
__________________
http://www.francescoinsvezia.net Il mio blog scandinavo! aka "La mia vita fra la gnokka" ![]() ![]() |
![]() |
![]() |
![]() |
#9 | |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Quote:
![]() cacti & co. continuano a mostrarmi la homepage del server d default..... ![]()
__________________
Powered by Apple Macbook Pro Retina |
|
![]() |
![]() |
![]() |
#10 |
Senior Member
Iscritto dal: Nov 2001
Città: Malmö (Svezia) - Copenhagen
Messaggi: 962
|
mmm... in un paio di casi lo ha fatto anche a me...
sei certo che tutti i siti siano nella root del server web? x esempio, se la root di apache é /var/www/html i sottodomini puntano a /var/www/html/cacti e /var/www/html/webmail ? perché io una volta feci bordello pensando di poter mettere alcune cose su /home/cacti e col cavolo che funzionava. Tra l'altro io prima avevo mdk sul server e funzionava regolarmente senza darmi errori di sorta, mentre ora con gentoo funziona, ma mi dá l'errore che dá a te all'avvio. Su mdk avevo dovuto aggiungere una linea x ogni VirtualHost in httpd2.conf sotto la direttiva prefork MPM (non so perché lo facessi... se ricordo bene lo avevo osservato fare da webmin e ho semplicemente seguito la prassi, e tutto andava). Se riguardi il mio apache2.conf queste linee (i.e. #NameVirtualHost francescoinsvezia.net) ci sono ancora, peró commentate.
__________________
http://www.francescoinsvezia.net Il mio blog scandinavo! aka "La mia vita fra la gnokka" ![]() ![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Quote:
__________________
Powered by Apple Macbook Pro Retina |
|
![]() |
![]() |
![]() |
#12 |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Bene... finalmente i Vhosts mi funzionano; precisamente nn so cos'ho fatto a parte quello d splittare i .conf e creare 1 bel vhosts.conf dentro /etc/httpd/conf.d e fare l'include nel httpd.conf base...
nel log message continuo, però, ad avere questi errori : Codice:
[warn] NameVirtualHost cacti.mydomain.com0 has no VirtualHosts [warn] NameVirtualHost www.my2domain.com:0 has no VirtualHosts [warn] NameVirtualHost webmail.mydomain.com:0 has no VirtualHosts
__________________
Powered by Apple Macbook Pro Retina |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:47.