Jump to content

trying to config apache httpd.conf file for virtual hosts but I get an error


cluce

Recommended Posts

Can someone please tell me what I am doing wrong in my httpd.conf file? I added two virtual hosts to this file but I dont know if its right because I get a forbidden error.      "FORBIDDEN:You don't have permission to access on this server. "

 

here is my Apache httpd.conf file

###*********************************************************

###*  Web-Developer Server Suite                          *

###*  http://sourceforge.net/projects/webdeveloper        *

###*  devside_net@users.sourceforge.net                    *

###*  v1.95-httpd22-ssl                                    *

###*********************************************************

 

 

ThreadsPerChild 250

MaxRequestsPerChild  0

 

Listen 80

 

ServerRoot "/www/Apache22"

DocumentRoot "/www/webroot"

 

ServerName localhost:80

ServerAdmin admin@localhost

 

ErrorLog logs/error.log

LogLevel error

 

###

# Note that the following LoadModule lines only represent the minimum 'Web-Developer' Suite configuration.

#

# Also note that some of the following LoadModule lines, which are commented out, are still loaded under...

# conf\Suite-extra\*.conf

# conf\extra\*.conf

# ...configuration files -- for modular reasons.

#

# For example:

# mod_deflate is loaded under conf\Suite-extra\mod_deflate_logio.conf and NOT under httpd.conf

# status_module is loaded under conf\extra\httpd-info.conf and NOT under httpd.conf

#

# Check last part of httpd.conf for the Apache base and 'Web-Developer' *.conf files that are included.

###

 

#LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

#LoadModule asis_module modules/mod_asis.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_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_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

#LoadModule cern_meta_module modules/mod_cern_meta.so

#LoadModule cgi_module modules/mod_cgi.so

#LoadModule dav_module modules/mod_dav.so

#LoadModule dav_fs_module modules/mod_dav_fs.so

#LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

#LoadModule env_module modules/mod_env.so

#LoadModule expires_module modules/mod_expires.so

#LoadModule file_cache_module modules/mod_file_cache.so

#LoadModule headers_module modules/mod_headers.so

#LoadModule imagemap_module modules/mod_imagemap.so

#LoadModule include_module modules/mod_include.so

#LoadModule info_module modules/mod_info.so

#LoadModule isapi_module modules/mod_isapi.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule mime_module modules/mod_mime.so

#LoadModule mime_magic_module modules/mod_mime_magic.so

#LoadModule proxy_module modules/mod_proxy.so

#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

#LoadModule proxy_connect_module modules/mod_proxy_connect.so

#LoadModule proxy_http_module modules/mod_proxy_http.so

#LoadModule proxy_ftp_module modules/mod_proxy_ftp.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

#LoadModule status_module modules/mod_status.so

#LoadModule unique_id_module modules/mod_unique_id.so

#LoadModule userdir_module modules/mod_userdir.so

#LoadModule usertrack_module modules/mod_usertrack.so

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

 

 

DefaultType text/plain

 

<IfModule dir_module>

    DirectoryIndex index.html index.php index.aspx

</IfModule>

 

IndexIgnore .htaccess

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

</FilesMatch>

 

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all

    Satisfy all

</Directory>

 

<Directory "/www/webroot">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

 

<IfModule mime_module>

    TypesConfig conf/mime.types

    AddType application/x-compress .Z

    AddType application/x-gzip .gz .tgz

</IfModule>

 

# Apache base configuration

#

# The configuration files in the conf/extra/ directory can be

# included to add extra features or to modify the default configuration of

# the server.

 

# Server-pool management (MPM specific)

#Include conf/extra/httpd-mpm.conf

 

# Multi-language error messages

#Include conf/extra/httpd-multilang-errordoc.conf

 

# Fancy directory listings

Include conf/extra/httpd-autoindex.conf

 

# Language settings

Include conf/extra/httpd-languages.conf

 

# User home directories

#Include conf/extra/httpd-userdir.conf

 

# Real-time info on requests and configuration

#Include conf/extra/httpd-info.conf

 

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

 

NameVirtualHost *:80

 

<VirtualHost *:80>

  ServerName  host1.net

  ServerAlias www.host1.net

  DocumentRoot /www/vhosts/host1.net

  ErrorLog /www/Apache22/logs/error.log

 

        <Directory "/www/vhosts/host1.net">

                Options All

                AllowOverride All

                order allow,deny

                allow from all

 

      AddType text/html .php .phps

      AddHandler application/x-httpd-php .php

      AddHandler application/x-httpd-php-source .phps

 

        </Directory>

</VirtualHost>

 

<VirtualHost *:80>

  ServerName  host2.net

  ServerAlias www.host2.net

  DocumentRoot /www/vhosts/host2.net

  ErrorLog /www/Apache22/logs/error.log

 

        <Directory "/www/vhosts/host2.net">

                Options All

                AllowOverride All

                order allow,deny

                allow from all

 

      AddType text/html .php .phps

      AddHandler application/x-httpd-php .php

      AddHandler application/x-httpd-php-source .phps

 

        </Directory>

</VirtualHost>

 

# Local access to the Apache HTTP Server Manual

Include conf/extra/httpd-manual.conf

 

# Distributed authoring and versioning (WebDAV)

#Include conf/extra/httpd-dav.conf

 

# Various default settings

Include conf/extra/httpd-default.conf

 

 

# DeveloperSide.NET Server-Suite Configuration

#

# The configuration files in the conf/Suite-extra/ directory can be

# included to add extra features or to modify the default configuration of

# the server.

#

# The specifics are loaded under components.conf...

 

Include conf/Suite-extra/components.conf

 

 

# Security check -- if no php module is loaded, Apache should return 'permissions denied' on php(4,5) all URL requests

<IfModule !php5_module>

<IfModule !php4_module>

<Location />

<FilesMatch "\.php[45]?$">

Order allow,deny

Deny from all

</FilesMatch>

</Location>

</IfModule>

</IfModule>

 

 

<IfModule ssl_module>

Include conf/extra/httpd-ssl.conf

SSLRandomSeed startup builtin

SSLRandomSeed connect builtin

</IfModule>

Link to comment
Share on other sites

Are you trying to access the root directory?  If so, then your error may be here:

 

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all

    Satisfy all

</Directory>

 

Remove the "Deny from all" and replace it with "Allow from all"

 

Does the error log say anything like client denied by server configuration when you get the forbidden error?

Link to comment
Share on other sites

yeah I would think that but that didnt work. also, the other problem I have with the the virtual host module I added is it screwed up my access to the (localhost) parent directory which now gives me a Forbidden error when I type in localhost in the address bar???

 

could you tell me does my config file at least look right to you or not?

Link to comment
Share on other sites

As far as I know, if your going to have virtual hosts, you need to make all your sites virtual hosts. ie, You can't have any site within the global scope of the httpd.conf file.

 

So... remove these lines....

 

DocumentRoot "/www/webroot"
ServerName localhost:80
ServerAdmin admin@localhost

 

And add another virtaul host....

 

<VirtualHost *:80>
  # Dont need to name the default host.
  #ServerName localhost
  DocumentRoot "/www/webroot"
  <Directory "/www/webroott">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all

    AddType text/html .php .phps
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .phps
  </Directory>
</VirtualHost>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.