NetVision-Technik

NetVision-Technik (http://www.netvision-technik.de/forum/index.php)
-   Webserver (http://www.netvision-technik.de/forum/forumdisplay.php?f=9)
-   -   Webserver-Config (http://www.netvision-technik.de/forum/showthread.php?t=2711)

Cerberus 29.01.2009 12:37

Webserver-Config
 
So -- da ich nun mehrfach gebeten wurde, unsre/meine Server-Config mal zu posten, möchte ich das nun hier mal erledigen ...

Installation der Teile und APC sollten erledigt sein :)

fangen wird mal an:

Apache
/etc/apache2/sites-enabled (AUSZUG)
Code:

NameVirtualHost *
<VirtualHost *>
    ServerAdmin webmaster@localhost
    ServerName www.XXXXXXXXXXXXX.*
    ServerAlias XXXXXXXXXXXXX.*cx *.XXXXXXXXXXXXX.*x
   
    DocumentRoot /var/www/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        # AllowOverride None
        Order allow,deny
        allow from all
        # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
              #  RedirectMatch ^/$ /apache2-default/
    </Directory>

    <IfModule sapi_apache2.c>
        php_admin_value upload_max_filesize 1406978
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www:/tmp:/var/lib/php5:/usr/share/phpmyadmin:/etc/phpmyadmin"
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_value upload_max_filesize 1406978
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www:/tmp:/var/lib/php5:/usr/share/phpmyadmin:/etc/phpmyadmin"
    </IfModule>

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

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

weiter zur php.ini (AUSZUG)
Code:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;  extension=modulename.extension
;
; For example, on Windows:
;
;  extension=msql.dll
;
; ... or under UNIX:
;
;  extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.


; Example lines:

;extension=mysql.so
;extension=gd.so

extension="apc.so"
apc.enabled=1
apc.file_update_protection=2
apc.optimization=0
apc.shm_size=32
apc.shm_segments=1
apc.gc_ttl=7200
apc.ttl=7200
apc.num_files_hint=1024
apc.enable_cli=0

weiter zum Mysql (my.cnf) (AUSZUG)
Code:

#
# * Fine Tuning
#
key_buffer        = 128M
max_allowed_packet    = 16M
sort_buffer        = 15M
thread_stack        = 128K
thread_cache        = 32
thread_cache_size    = 8
max_connections    = 500
table_cache        = 512
#thread_concurrency    = 10
#
# * Query Cache Configuration
#
query_cache_limit      = 1M
query_cache_size        = 16M

so -- :)
ich hoffe, ich hab nix vergessen :)

nur die Zusatzteile hab ich weggelassen :)

Solstice 29.01.2009 12:47

wow... mysql und php.ini sind sogar kleiner als bei mir... nicht möglich..

aber Vhost hab ich kleiner...

bei mir besteht der nur noch aus nem allgemeinen Teil und nem spezifischen teil...

beides klein gehalten..

vll weiß ich aber auch vieles nicht XD

also so:
Zitat:

NameVirtualHost *


<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
ServerTokens Prod
ServerSignature Off
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
LogLevel warn


<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName XX
ServerAlias XX *.XX
DocumentRoot /var/www/XX/
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName http://XX.*
ServerAlias XX.* *.XX.*
DocumentRoot /var/www/XX/
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName http://XX.*
ServerAlias XX.* *.XX.*
DocumentRoot /var/www/XX/
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName http://XX.nu
ServerAlias XX.nu *.XX.nu
DocumentRoot /var/www/XX/

<Directory /var/www/roko/>
Options Indexes
</Directory>
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName http://XX.*
ServerAlias XX.**.XX.*
DocumentRoot /var/www/XX/
</VirtualHost>
Edit:
Welche Zusatzteile Cerb?

Cerberus 29.01.2009 12:51

naja -- es sind immer nur die entsprechenden Auszüge :)
hab das oben mal ergänzt ...

aber vielleicht kannste ja das eine oder andere auch gebrauchen :)

Uhrzeit-Syncro
APC
Server-Schutz
Apache-Sicherheit
....
und noch einige andere nette "Gimmicks" .....

aber für sowas hab ich nen "Kaputten" hier im Haus wohnen, der mir sowas macht :)
weil da fehlt mir irgendwie das Verständnis für ...

schienbein 29.01.2009 13:02

hier mal meine variante des vhost sowol http als auch https


PHP-Code:


NameVirtualHost 
*:80
NameVirtualHost 
*:443
<VirtualHost *:80>
    
ServerAdmin webmaster@localhost
    
    DocumentRoot 
/xxx/xxx/xxxx
    
<Directory />
        
Options FollowSymLinks
        AllowOverride None
    
</Directory>
    <
Directory /xxx/xxxx/xxxx>
        
Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow
,deny
        allow from all
        
# This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # RedirectMatch ^/$ /apache2-default/
    
</Directory>

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

    
ErrorLog /var/log/apache2/error.log

    
# Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    
LogLevel warn

    CustomLog 
/var/log/apache2/access.log combined
    ServerSignature On

    Alias 
/doc"/usr/share/doc/"
    
<Directory "/usr/share/doc/">
        
Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny
,allow
        Deny from all
        Allow from 127.0.0.0
/255.0.0.0 ::1/128
    
</Directory>
</
VirtualHost>

<
VirtualHost *:443>
    
ServerAdmin webmaster@localhost
       SSLEngine on
    SSLCertificateFile 
/etc/apache2/ssl/apache.pem
       SSLCertificateKeyFile 
/etc/apache2/ZERTIFIKATSNAME.0
    DocumentRoot 
/xxx/xxx/xxxx
    
<Directory />
        
Options FollowSymLinks
        AllowOverride None
    
</Directory>
    <
Directory /xxxx/xxxx/>
        
Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow
,deny
        allow from all
        
# This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # RedirectMatch ^/$ /apache2-default/
    
</Directory>

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

    
ErrorLog /var/log/apache2/error.log

    
# Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    
LogLevel warn

    CustomLog 
/var/log/apache2/access.log combined
    ServerSignature On

    Alias 
/doc"/usr/share/doc/"
    
<Directory "/usr/share/doc/">
        
Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny
,allow
        Deny from all
        Allow from 127.0.0.0
/255.0.0.0 ::1/128
    
</Directory>
</
VirtualHost

in meiner Apache config habe ich zusätzlich noch das drin



PHP-Code:

# Keine Darstellung durch Debian Apache des Verzeichnisinhalts erlaubt
<Directory “/var/www”>
Options -Indexes
Order allow
,deny
Allow from all
</Directory

mfg schienbein

Cerberus 29.01.2009 13:10

ich würde jedem empfehlen, unter Debian dafür zu sorgen, das die Scripte keinen systemweiten Zugriff bekommen ....

Solstice 29.01.2009 15:13

etz sag noch wie...

und das was dein "Kaputter" mit Apache und serversicherheit gemacht hat wär auch noch interressant... Kaputte wissen immer etwas mehr...

Cerberus 29.01.2009 15:49

Zitat:

Zitat von Solstice (Beitrag 26721)
etz sag noch wie...

hää ....
was soll ich sagen ????

Solstice 29.01.2009 16:36

Bezogen auf deinen oberen Post und das:
Zitat:

Server-Schutz
Apache-Sicherheit

Scheint so als hätt das forum wieder die hälfte meines beitrags verschluckt

$iMpLy 30.01.2009 16:27

hab auch mal ne kleine frage, für was genau ist das:
Code:

<IfModule sapi_apache2.c>
        php_admin_value upload_max_filesize 1406978
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www:/tmp:/var/lib/php5:/usr/share/phpmyadmin:/etc/phpmyadmin"
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_value upload_max_filesize 1406978
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www:/tmp:/var/lib/php5:/usr/share/phpmyadmin:/etc/phpmyadmin"
    </IfModule>


Cerberus 30.01.2009 16:45

Grundsicherheit des vHosts im Apache und Beschränkung der Script-Rechte auf bestimmte Verzeichnisse ...

also mit anderen Worten -- selbst wenn ein Spaßvogel versuchten sollte über irgend eine Lücke an die Server-Daten zu kommen -- PHP und APACHE haben auf die anderen Verzeichnisse auf dem Server KEINEN Zugriff ...
selbst eine korrekte Pfadangabe hat den Fehler 404 (Dokument nicht gefunden) zur Folge :D

außerdem wird dort auch die maximale Uplaod-Größe für den vHost beschränkt


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:53 Uhr.

Powered by vBulletin® Version 3.8.9 (Deutsch)
Copyright ©2000 - 2025, vBulletin Solutions, Inc.