Webserver "besser" konfigurieren ?!

  • #1
V

VoiD

Bekanntes Mitglied
Themenersteller
Dabei seit
05.06.2002
Beiträge
155
Reaktionspunkte
0
Gandalf hat in diesem Thread in etwa dieses Posting (stark verkürzt) abgegeben:

Gandalf_the_Grey schrieb:
So ganz falsch hast du mich gar nicht verstanden! Folgendes, der Server auf dem der WEBSERVER läuft hat ja ein Dateisystem, z.B. FAT, FAT32, NTFS, ext oder sowas ähnliches. Je nach Betriebssystem. Der Webserver hat wiederum ein virtuelles Dateisystem das im sogenannten Document Root beginnt. Der Pfad des Document Root kann in der http.conf festgelegt/verändert werden. Aus Sicherheitsgründen legt man aber user Verzeichnisse außerhalb dieses Document Roots ab, denn wenn man unterhalb des Document Roots eine Verwaltung für die User aufbauen würde kriegt man früher oder später nur Probleme. (Z.B. mit den Rechten) Deshalb konfiguriert man den Apache entsprechend um das er auch außerhalb des Doc Roots sehen und Skripte bzw. HTML Daten ausführen kann. Die Variable Document Root bezieht sich aber immer auf das im Webserver eingestellte Wurzelverzeichniss. Es ist der Zeiger der das physische Dateisystem des Servers mit dem Wurzelverzeichniss des virtuellen Dateisystems des Webservers verknüpft.

Beispiel:

Wenn der Apache auf F:\Apache installiert ist und der DocRoot nicht verändert wurde dann wird die Variable DocRoot F:\Apache\htdocs anzeigen. Das bedeutet das ab da das virtuelle Dateisystem beginnt.

Wenn nun aber per Webserver definiert wurde das die Verzeichniss der einzelnen User auf G:\User\bla\ deffiniert sind, und du nun mit der Variable DocRoot arbeitest und versuchst ein Script im Verzeichniss Verzeichnisfürscript\index.php aufzurufen wird er das Script unter F:\Apache\htdocs\Verzeichnisfürscript\index.php suchen und nicht unter G:\User\bla\Verzeichnisfürscript\index.php

Wenn du allerdings das Script nicht per DocRoot Variable aufgerufen hättest sondern per /Verzeichnisfürscript\index.php dann wäre der Webserver in das angegebene HOME Verzeichniss des Users gesprungen und hätte das Script an entsprechender Stelle gefunden.

So, jetzt meine Frage hierzu:

Kannst Du Gandalf (oder wer sonst das weiss) mal bitte die entsprechende Konfiguration für den Webserver hier angeben? Würde mich schon interessieren, wie man das ganze so erledigt und damit anscheinend ja auch sicherer macht.

Danke + Gruß
VoiDy
 
  • #2
Ufz, jetzt erschlägst du mich etwas so spät am Nachmittag. Hast mich echt kalt erwischt. ;D

Ist lange her das ich nen Webserver überhaupt unter Windows selbst hochgezogen habe. Nutze unter Windows nur noch XAMPP weil es einfach zum testen schneller geht und einfacher ist, da muss ich nix mehr groß konfigurieren. Zuhause sieht das natürlich anders aus, da läuft ein selbst konfigurierter Apache unter Debian Sarge. Aber zurück zum Thema. Ich schaffe es heute vermutlich nicht, versuche aber morgen oder spätestens Sonntag meine http.conf zu posten. Da müsstest du schon sehen können was du wo verändern musst und wie du weiter vorgehst.

Hoffe das dir das nicht zu lange ist. Vieleicht ist ja jemand anders hier schneller. Ansonsten Samstag respektive Sonntag. Im Zweifel können wir uns auch mal per ICQ treffen. Ich mache sowas zwar lieber im Forum (da haben nämlich alle was davon) Aber im Zweifel geht das auch Ausnahmsweise mal so.
 
  • #3
ICQ benutze ich nicht, ist mir zu gefährlich. Und wenn Du das für mich extra zusammenstellst, dann warte iich doch gerne den einen oder anderen Tag :)
 
  • #4
So, da ich nun endlich wieder halbwegs fit bin, kann ich auch endlich auf die gestellte Frage Antworten. Nochmal kurz vorweg, ich beschreibe das ganze jetzt eher aus Linux/Unix sicht, das ganze müsste sich aber 1 zu 1 auf Windows übertragen lassen. Also, um einem Rechte Problem, und vor allem dem Problem der sauberen Trennung aus dem Weg zu gehen, verschiebt man am Idealsten einen Userbezogenen Bereich außerhalb des Apache Webservers und konfiguriert diesen so um, das im Entsprechenden Verzeichniss des Users eine Ausführung von HTML/PHP usw. möglich ist. (Zum Thema erreichbarkeit kann ich nur sagen, versucht mal 10 User unter den Document Root des Webservers zu legen, und sagt mir nachher noch einwandfrei wie ihr die einzelnen User per .. erreicht. Es wird nämlich irgendwann ein ziemlicher Verzeichniss wirrwar.)

So, aber bevor ich mich jetzt hier unnötig Tod schreibe, die hälfte falsch bzw. überflüssig erkläre, habe ich mich eben entschlossen einen anderen Weg zu gehen.

Lies dir doch mal einführend folgende beiden Doku's durch und frag einfach wenn du ggf. noch Fragen/Probleme hast.

Die Doku's sind folgende:

und


Die müssten eigentlich alles nötige klären/erklären.

Hoffe das hilft dir weiter.
 
  • #6
So, hier mal eine httpd.conf wie sie aussehen könnte.

# Please keep this LoadModule: line here, it is needed for installation.

ServerType standalone
ServerRoot /etc/apache
LockFile /var/lock/apache.lock
PidFile /var/run/apache.pid
ScoreBoardFile /var/run/apache.scoreboard

Timeout 100
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 200
MaxRequestsPerChild 100

LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
LoadModule status_module /usr/lib/apache/1.3/mod_status.so
LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
LoadModule access_module /usr/lib/apache/1.3/mod_access.so
LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so
LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so
LoadModule unique_id_module /usr/lib/apache/1.3/mod_unique_id.so
LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
# GZIP compression
LoadModule gzip_module /usr/lib/apache/1.3/mod_gzip.so
# SSI - includes
LoadModule includes_module /usr/lib/apache/1.3/mod_include.so

ExtendedStatus On

Port 80

User www-data
Group www-data

ServerAdmin [email protected]
ServerName XXXXX.XX
DocumentRoot /var/www

RewriteEngine On
#RewriteLog /var/log/apache/rewrite.log
#RewriteLogLevel 1

<Directory />
Options SymLinksIfOwnerMatch
AllowOverride None

ErrorDocument 404 /404.html
ErrorDocument 401 /404.html
ErrorDocument 403 /404.html
</Directory>

<Directory /var/www/>
RewriteEngine On
Options Indexes +Includes IncludesNOEXEC FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>

<Directory /home/*/public_html>
RewriteEngine On
AllowOverride FileInfo AuthConfig Limit Indexes Options
Options MultiViews FollowSymLinks Indexes SymLinksIfOwnerMatch +Includes IncludesNOEXEC ExecCGI +Indexes
php_flag engine on
php_admin_flag safe_mode On
RLimitCPU 180 180
RLimitMEM 10240000
#RLimitNPROC 10 15
</Directory>

<Directory /home/*/*/public_html>
RewriteEngine On
AllowOverride FileInfo AuthConfig Limit Indexes Options
Options MultiViews FollowSymLinks Indexes SymLinksIfOwnerMatch +Includes IncludesNOEXEC ExecCGI +Indexes
php_flag engine on
php_admin_flag safe_mode On
RLimitCPU 180 180
RLimitMEM 10240000
#RLimitNPROC 10 15
</Directory>

<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.shtml index.php index.php3
</IfModule>

AccessFileName .htaccess

<Files ~ ^\.ht>
Order allow,deny
Deny from all
</Files>

UseCanonicalName On
TypesConfig /etc/mime.types
DefaultType text/plain

<IfModule mod_mime_magic.c>
MIMEMagicFile share/magic
</IfModule>

HostnameLookups Off

ErrorLog /var/log/apache/error.log

LogLevel warn

LogFormat %h %l %u %t \%r\ %>s %b \%{Referer}i\ \%{User-Agent}i\ %T %v full
LogFormat %h %l %u %t \%r\ %>s %b \%{Referer}i\ \%{User-Agent}i\ %P %T debug
LogFormat %h %l %u %t \%r\ %>s %b \%{Referer}i\ \%{User-Agent}i\ combined
LogFormat %h %l %u %t \%r\ %>s %b common
LogFormat %{Referer}i -> %U referer
LogFormat %{User-agent}i agent

CustomLog /var/log/apache/access.log combined

ServerSignature off
ServerTokens Min

Alias /icons/ /usr/share/apache/icons/

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

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory /usr/lib/cgi-bin/>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>


<IfModule mod_autoindex.c>

IndexOptions FancyIndexing NameWidth=*
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/deb.gif .deb

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README
HeaderName HEADER

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

</IfModule>

<IfModule mod_mime.c>

# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+)
# uncompress information on the fly. Note: Not all browsers support
# this. Despite the name similarity, the following Add* directives
# have nothing to do with the FancyIndexing customization
# directives above.

AddEncoding x-compress Z
AddEncoding x-gzip gz tgz

#
# AddLanguage: allows you to specify the language of a document. You can
# then use content negotiation to give a browser a file in a language
# it can understand.
#
# Note 1: The suffix does not have to be the same as the language
# keyword --- those with documents in Polish (whose net-standard
# language code is pl) may wish to use AddLanguage pl .po to
# avoid the ambiguity with the common suffix for perl scripts.
#
# Note 2: The example entries below illustrate that in quite
# some cases the two character->Language' abbriviation is not
# identical to the two character->Country' code for its country,
# E.g.->Danmark/dk' versus->Danish/da'.
#
# Note 3: In the case of->ltz' we violate the RFC by using a three char
# specifier. But there is->work in progress' to fix this and get
# the reference data for rfc1766 cleaned up.
#
# Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
# French (fr) - German (de) - Greek-Modern (el)
# Italian (it) - Portugese (pt) - Luxembourgeois* (ltz)
# Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz)
# Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
#
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz

# LanguagePriority: allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change
# this.
#
<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja pl pt pt-br ltz ca es sv
</IfModule>

#
# AddType allows you to tweak mime.types without actually editing
# it, or to make certain files to be certain types.
#
# For example, the PHP 3.x module (not part of the Apache
# distribution - see ) will typically use:
#
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#
# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps

AddType application/x-tar .tgz
AddType image/bmp .bmp

# hdml
AddType text/x-hdml .hdml

#
# AddHandler allows you to map certain file extensions to handlers,
# actions unrelated to filetype. These can be either built into
# the server or added with the Action command (see below).
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
AddHandler cgi-script .cgi .sh .pl .py

#
# To use server-parsed HTML files
#
AddType text/html .shtml
AddHandler server-parsed .shtml

#
# Uncomment the following line to enable Apache's send-asis HTTP
# file feature.
#
#AddHandler send-as-is asis

#
# If you wish to use server-parsed imagemap files, use
#
#AddHandler imap-file map

#
# To enable type maps, you might want to use
#
#AddHandler type-map var

</IfModule>

AddDefaultCharset on

<IfModule mod_setenvif.c>
#
# The following directives modify normal HTTP response behavior.
# The first directive disables keepalive for Netscape 2.x and browsers that
# spoof it. There are known problems with these browser implementations.
# The second directive is for Microsoft Internet Explorer 4.0b2
# which has a broken HTTP/1.1 implementation and does not properly
# support keepalive when it is used on 301 or 302 (redirect) responses.
#
BrowserMatch Mozilla/2 nokeepalive
BrowserMatch MSIE 4\.0b2; nokeepalive downgrade-1.0 force-response-1.0

#
# The following directive disables HTTP/1.1 responses to browsers which
# are in violation of the HTTP/1.0 spec by not being able to grok a
# basic 1.1 response.
#
BrowserMatch RealPlayer 4\.0 force-response-1.0
BrowserMatch Java/1\.0 force-response-1.0
BrowserMatch JDK/1\.0 force-response-1.0
</IfModule>


<IfModule mod_perl.c>
Alias /perl/ /var/www/perl/
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</IfModule>

Alias /doc/ /usr/share/doc/

# Mailman
Alias /pipermail/ /var/lib/mailman/archives/public/
<Directory /var/lib/mailman/archives/public>
AddDefaultCharset Off
Options FollowSymLinks
order allow,deny
allow from all
</Directory>

<Location /doc>
order deny,allow
deny from all
allow from 127.0.0.0/255.0.0.0
Options Indexes FollowSymLinks MultiViews
</Location>

#<Location /cgi-bin/phf*>
# Deny from all
# ErrorDocument 403
#</Location>

<IfModule mod_proxy.c>
#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
#<IfModule mod_proxy.c>
#ProxyRequests On
#
#<Directory proxy:*>
# Order deny,allow
# Deny from all
# Allow from .your_domain.com
#</Directory>
</IfModule>

###
# Virtual Hosts - Oct/2003
###

BindAddress *
NameVirtualHost *

<VirtualHost *>
ServerName XXXXX.XX
DocumentRoot /var/www
</VirtualHost>

<VirtualHost *>
ServerName webhunt.lir.dk
DocumentRoot /home/k/kefe/public_html
User kefe
Group users
</VirtualHost>

<VirtualHost *>
ServerName dev.XXXXX.XX
DocumentRoot /home/c/c32/public_html/dev
User c32
Group users
</VirtualHost>

# Ensure SSL-Webmail only:
<Location /cgi-bin/sqwebmai*>
Deny from all
ErrorDocument 403
</Location>
<Location /squirrelmail/*/*>
Deny from all
ErrorDocument 403
</Location>
<Location /squirrelmail>
Deny from all
ErrorDocument 403
</Location>
<Location /phpmyadmin>
Deny from all
ErrorDocument 403
</Location>
# End Ensure SSL-Webmail

# INCLUDES:
Include /etc/phpmyadmin/apache.conf
# Mailscanner MRTG
Include /etc/apache/conf/mailscanner-mrtg.include
# End INCLUDES

# Config MOD_GZIP
mod_gzip_on Yes
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime text/.*
mod_gzip_item_include mime httpd/unix-directory
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/plain$
mod_gzip_dechunk yes
mod_gzip_temp_dir /tmp
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 1024
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_item_exclude file nph-.*\.cgi$
# End MOD_GZIP

Include /etc/squirrelmail/apache.conf

### END httpd.conf
 
Thema:

Webserver "besser" konfigurieren ?!

ANGEBOTE & SPONSOREN

Statistik des Forums

Themen
113.840
Beiträge
707.963
Mitglieder
51.494
Neuestes Mitglied
Flensburg45
Oben