View previous topic :: View next topic |
Author |
Message |
Blackmamba Tux's lil' helper
Joined: 28 Aug 2007 Posts: 116 Location: Germany
|
Posted: Mon Sep 24, 2007 9:23 pm Post subject: Apache problem |
|
|
When try to restart apache i get this:
Code: |
/etc/init.d/apache2 restart
* Apache2 has detected a syntax error in your configuration files:
Syntax error on line 193 of /etc/apache2/httpd.conf:
NameVirtualHost takes one argument, A numeric IP address:port, or the name of a host
|
I have tried every ip! no one work, not even with :80 or :8080 behind.
Any ideas?
Anyway...any good howtos on Virtualhosts? can't find any |
|
Back to top |
|
|
jonnevers Veteran
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Mon Sep 24, 2007 10:04 pm Post subject: Re: Apache problem |
|
|
Blackmamba wrote: | I have tried every ip! no one work, not even with :80 or :8080 behind.
Any ideas?
|
can you dump your httpd.conf into pastebin (or similiar service) and post a link?
this will bind the virtual hosts to port 80 on all available ip addresses
Code: | Listen 80
NameVirtualHost *:80 |
for a simple, default virtual host;
/etc/apache2/vhosts.d/00_define_default_NameVirtualHost.conf:
Code: | <IfDefine DEFAULT_VHOST>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName subdomain.domainname.tld
DocumentRoot /path/to/documents
ServerAdmin admin@domainname.tld
<Directory /path/to/documents>
AllowOverride All
Order deny,allow
</Directory>
</VirtualHost>
</IfDefine> |
when you enable vhosts, apache will now try to load all *.conf files in /etc/apache2/vhosts.d
/etc/apache2/httpd.conf wrote: | # Virtual-host support
#
# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we
# include a default vhost (enabled by adding -D DEFAULT_VHOST to
# APACHE2_OPTS in /etc/conf.d/apache2).
Include /etc/apache2/vhosts.d/*.conf |
so you define your default NameVirtualHost directive and create a default vhost for the domain.
then you just create new /etc/apache2/whatever.conf to create a new vhost:
Code: | <VirtualHost *:80>
ServerName newhost.domainname.tld
Whatever Else
</VirtualHost> |
http://httpd.apache.org/docs/2.2/vhosts/ |
|
Back to top |
|
|
Blackmamba Tux's lil' helper
Joined: 28 Aug 2007 Posts: 116 Location: Germany
|
Posted: Mon Sep 24, 2007 11:06 pm Post subject: |
|
|
wow nice reply
Why can't i just post it here?
Code: |
# This is a modification of the default Apache 2.2 configuration file
# for Gentoo Linux.
#
# Support:
# http://www.gentoo.org/main/en/lists.xml [mailing lists]
# http://forums.gentoo.org/ [web forums]
# irc://irc.freenode.net#gentoo-apache [irc chat]
#
# Bug Reports:
# http://bugs.gentoo.org [gentoo related bugs]
# http://httpd.apache.org/bug_report.html [apache httpd related bugs]
#
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "var/log/apache2/foo.log"
# with ServerRoot set to "/usr" will be interpreted by the
# server as "/usr/var/log/apache2/foo.log".
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
ServerRoot "/usr/lib/apache2"
ServerName ac-designs.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
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
# GENTOO: Automatically defined based on apache2-builtin-mods at compile time
#
# The following modules are considered as the default configuration.
# If you wish to disable one of them, you may have to alter other
# configuration directives.
#
# Change these at your own risk!
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.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
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 dbd_module modules/mod_dbd.so
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 ident_module modules/mod_ident.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
<IfDefine INFO>
LoadModule info_module modules/mod_info.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
<IfDefine PROXY>
LoadModule proxy_module modules/mod_proxy.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_connect_module modules/mod_proxy_connect.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_http_module modules/mod_proxy_http.so
</IfDefine>
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule speling_module modules/mod_speling.so
<IfDefine INFO>
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
<IfDefine LDAP>
LoadModule ldap_module modules/mod_ldap.so
</IfDefine>
<IfDefine AUTH_LDAP>
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
</IfDefine>
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
<IfDefine SUEXEC>
LoadModule suexec_module modules/mod_suexec.so
</IfDefine>
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User apache
Group apache
# Supplemental configuration
#
# Most of the configuration files in the /etc/apache2/modules.d/ directory can
# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features
# or to modify the default configuration of the server.
#
# To know which flag to add to APACHE2_OPTS, look at the first line of the
# the file, which will usually be an <IfDefine OPTION> where OPTIONS is the
# flag to use.
Include /etc/apache2/modules.d/*.conf
# Virtual-host support
#
# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we
# include a default vhost (enabled by adding -D DEFAULT_VHOST to
# APACHE2_OPTS in /etc/conf.d/apache2).
Include /etc/apache2/vhosts.d/*.conf
# vim: ts=4 filetype=apache
#NameVirtualHost *.
NameVirtualHost *. #your ip address here
#Include apache2/vhost.d/default_vhost.include #add in your own includes:
|
|
|
Back to top |
|
|
Blackmamba Tux's lil' helper
Joined: 28 Aug 2007 Posts: 116 Location: Germany
|
Posted: Tue Sep 25, 2007 5:44 pm Post subject: |
|
|
Tried what you said, but now i get this.
Dunno what did wrong now.
Code: |
/etc/init.d/apache2 start
* Starting mysql ...
* Starting mysql (/etc/mysql/my.cnf) [ ok ]
* Apache2 has detected a syntax error in your configuration files:
apache2: Syntax error on line 188 of /etc/apache2/httpd.conf: Syntax error on line 50 of /etc/apache2/vhosts.d/00_default_vhost.conf: /etc/apache2/vhosts.d/00_default_vhost.conf:50: <Virtualhost> was not closed.
|
|
|
Back to top |
|
|
jonnevers Veteran
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Tue Sep 25, 2007 5:48 pm Post subject: |
|
|
Blackmamba wrote: | Why can't i just post it here? |
no real reason, except i think it's easier to read these types of large conf files outside of the forum page and it makes the forum posts longer then necessary, imo.
Blackmamba wrote: | Code: | /etc/apache2/vhosts.d/00_default_vhost.conf: /etc/apache2/vhosts.d/00_default_vhost.conf:50: <Virtualhost> was not closed. |
|
did you close the <VirtualHost></VirtualHost> tags on the line it's indicating?
can you post 00_default_vhost.conf?
btw, you can check your vhost configuration by running:
|
|
Back to top |
|
|
Blackmamba Tux's lil' helper
Joined: 28 Aug 2007 Posts: 116 Location: Germany
|
Posted: Tue Sep 25, 2007 6:04 pm Post subject: |
|
|
Here it is
Code: |
Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
# Use name-based virtual hosting.
NameVirtualHost *:80
# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
<VirtualHost *:80>
Include /etc/apache2/vhosts.d/default_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
</IfDefine>
# vim: ts=4 filetype=apache
#### LocalHost aka Domain 1 ####
<Virtualhost>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domain.net
DocumentRoot /var/www/localhost/htdocs
ServerAdmin admin@domain.net
<Directory /var/www/localhost/htdocs
AllowOverride All
Order deny,allow
</Directory>
</VirtualHost>
#### Domain 2 ####
<Virtualhost>
ServerName www.domain.net
DocumentRoot /var/www/localhost/htdocs
<Directory "/var/www/domain.net/htdocs">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
|
|
|
Back to top |
|
|
jonnevers Veteran
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Tue Sep 25, 2007 6:31 pm Post subject: |
|
|
your problem with in your Domain 1 declaration, two nested <VirtualHost>'s and only one closing </VirtualHost>:
Quote: | <Virtualhost>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domain.net
DocumentRoot /var/www/localhost/htdocs
ServerAdmin admin@domain.net
<Directory /var/www/localhost/htdocs
AllowOverride All
Order deny,allow
</Directory>
</VirtualHost> |
Code: |
<IfDefine DEFAULT_VHOST>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
Include /etc/apache2/vhosts.d/default_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
</IfDefine>
# Domain 1
<VirtualHost *:80>
ServerName domain.net
DocumentRoot /var/www/localhost/htdocs
ServerAdmin admin@domain.net
<Directory /var/www/localhost/htdocs
AllowOverride All
Order deny,allow
</Directory>
</VirtualHost>
# Domain 2
<VirtualHost *:80>
ServerName www.domain.net
DocumentRoot /var/www/localhost/htdocs
<Directory "/var/www/domain.net/htdocs">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost> |
|
|
Back to top |
|
|
Blackmamba Tux's lil' helper
Joined: 28 Aug 2007 Posts: 116 Location: Germany
|
Posted: Tue Sep 25, 2007 6:50 pm Post subject: |
|
|
lol i feel so blind!
Thanx |
|
Back to top |
|
|
|