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

DirtyPlaya 20.03.2009 09:44

und wie geht das???
kannst das nicht mal posten???

also das
PHP-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 

hat auch was gebracht

Cerberus 20.03.2009 19:05

naja -- also das kontrolliere ich alle Monate mal ...
und passe das dann immer an

FMI 23.07.2009 22:51

Hallo,

also in meine /etc/apache2/sites-enabled Verzeichnis ist nur eine 000-default Datei. Ich finde die php.ini und my.cnf Dateien nicht :(

Was soll ich nun tun???

MFG

gotthummer 24.07.2009 00:02

mache das was jeder machen muss um zu lernen googel und finde dann heraus wo diese dateien liegen oder kauf dir ein buch über debian und lese das oder guck hier im forum ist oft genug erklärt sry für die antwort aber irgendwann muss das mal gesagt werden den manche leute scheinen wirklich nix lernen zu wollen oder mal ein wenig selber nachzudenken bzw selber suchen zu wollen

MPL 24.07.2009 08:37

cerberus:

nimm folgendes raus

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>

ich denke mal du benutzt keine cgi scripte also warum angriffsraum anbieten ;)

ServerSignature auf off stellen ;)

und in der php.ini

expose_php = On
auf
expose_php = Off stellen ...

desweiteren:

; Select a hash function
; 0: MD5 (128 bits)
; 1: SHA-1 (160 bits)
session.hash_function = 1

; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
;
; 4 bits: 0-9, a-f
; 5 bits: 0-9, a-v
; 6 bits: 0-9, a-z, A-Z, "-", ","
session.hash_bits_per_character = 6

FMI 24.07.2009 09:15

Hallo,

dnak dir Gotthummer ;)

Da hast du eigentlich recht mit dem googlen.
habs gefunden ;)

PHP-Code:

/etc/php4/apache/php.ini 

Danke nochmals ;)

MFG

gotthummer 24.07.2009 09:48

siehste geht doch

Cerberus 24.07.2009 16:24

Zitat:

Code:

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>

ich denke mal du benutzt keine cgi scripte also warum angriffsraum anbieten ;)
done -- das leuchtet ein :)

Zitat:

ServerSignature auf off stellen ;)

und in der php.ini

expose_php = On
auf
expose_php = Off stellen ...
öhm -- will mich ja nicht outen --- aber kannste das mal genauer erklären ???

Zitat:

Code:

; Select a hash function
; 0: MD5  (128 bits)
; 1: SHA-1 (160 bits)
session.hash_function = 1

Code:

; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
;
; 4 bits: 0-9, a-f
; 5 bits: 0-9, a-v
; 6 bits: 0-9, a-z, A-Z, "-", ","
session.hash_bits_per_character = 6


leuchtet ein -- werde ich auch machen ...
hat das auswirkungen auf bisherige Hash-Funktionen/Werte

Pr1me 11.09.2009 12:18

Ab PHP 5.3 wird open_basedir auch für Änderungen während der Laufzeit mit der PHP Funktion ini_set freigegeben. Dadurch wird open_basedir für Zwecke des Einsperrens auf bestimmte Verzeichnisse am Webserver unwirksam...

Cerberus 11.09.2009 18:03

dann sollte man auch gleich ini_set verbieten :)

Pr1me 12.09.2009 09:12

Habs nur gepostet weil ich ne lebhafte Diskussion hatte ob es einem open_basedir für Passwortdateien wie die secrets.php oder der config.php bedarf, ich bin der Meinung nicht.


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:09 Uhr.

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