Benvenuto nella nostra community, registra un account gratuito ADESSO!
Oltre 7000 persone hanno già registrato il loro account. Chiedi aiuto, conversa con aziende ed esperti del settore webhosting italiano.
Iscriviti subito! In meno di 2 minuti!




Risultati da 1 a 14 di 14
  1. #1
    /etc/init.d/brain restart L'avatar di Luca
    Data Registrazione
    Feb 2006
    Località
    Bellaria
    Messaggi
    3,271

    Icog Come ottimizzare il WebServer

    Ciao a tutti,
    Scrivo questa guida, per darvi una "prima" mano alla configurazione del vostro Webserver o VPS. Onde evitare di fare "caos" nella vostra configurazione vi suggerisco di fare un bel backup del vostro server (Per chi usa Virtuozzo basta andare nel'apposita sezione), invece per chi ha un server dedicato senza possibilità di restore, direi solo di andare con cautela, ovviamente se succedono danni, non rispondo io
    La guida si divide in 4 parti:
    1. Ottimizzazione dei parametri di MySQL
    2. Installazione del mod_perl
    3. Installazione di Turck MMCache per PHP
    4. sysctl.conf
    Iniziamo ora va (Facciamo prima il rito preInstallazione )

    Requisiti:

    - Linux
    - Accesso di root
    - Un buon Backup del sistema

    Come fare:

    Accedere a SSH loggarsi come root e digitare:

    pico /etc/my.cnf
    E sostituire i parametri esistenti con quelli riportati sotto.
    NB: Controllare bene eventuali vostri parametri che non sono inseriti in questa config ed aggiungerli.

    Codice:
     [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-locking
    skip-innodb
    query_cache_limit=8M
    query_cache_size=256M
    query_cache_type=1
    max_connections=500
    max_user_connections=10
    interactive_timeout=20
    wait_timeout=20
    connect_timeout=6
    thread_cache_size=128
    key_buffer=16M
    join_buffer=1M
    max_allowed_packet=16M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=2M
    read_buffer_size=2M
    max_connect_errors=10
    # Try number of CPU's*2 for thread_concurrency
    thread_concurrency=4
    myisam_sort_buffer_size=64M
    #log-bin
    server-id=1
    
    [mysql.server]
    user=mysql
    basedir=/var/lib
    
    [safe_mysqld]
    err-log=/var/log/mysqld.log
    pid-file=/var/lib/mysql/mysql.pid
    open_files_limit=8192
    
    [mysqldump]
    quick
    max_allowed_packet=16M
    
    [mysql]
    no-auto-rehash
    #safe-updates
    
    [isamchk]
    key_buffer=32M
    sort_buffer=32M
    read_buffer=16M
    write_buffer=16M
    
    [myisamchk]
    key_buffer=32M
    sort_buffer=32M
    read_buffer=16M
    write_buffer=16M
    Ora premete CTRL + X per uscire e salvare il file.

    Riavviare Apache e MySQL con:
    service httpd restart
    service mysql restart OR service mysqld restart

    alcuni utenti dovranno riavviare apache e MySQL con:
    /etc/rc.d/init.d/httpd restart
    /etc/rc.d/init.d/mysql restart


    Installiamo il mod_perl

    Sempre da root digitiamo

    wget http://perl.apache.org/dist/mod_perl-1.0-current.tar.gz

    tar zxvf tar zxvf mod_perl-1.0-current.tar.gz

    cd mod_perl-1.29 (or whatever folder is generated)

    perl Makefile.PL

    // Se vedete errori *circa* di dipendenze mancanti quali (CGI.pm, LWP::UserAgent & HTML::HeadParser richiesto da mod_perl) potete installarli con:

    perl -MCPAN -e shell
    install HTML::HeadParser

    Ora non vi resta altro che fare

    make
    make install

    Ora avrete installato il mod_perl, riavviate apache e passate al passaggio successivo


    Installazione di Turck MMCache per PHP

    Turck MMCacge richiede: apache 1.3, mod_php 4.1, autoconf, automake, libtool, m4. Se non avete questi pacchetti potete scaricarli ed installarli con YUM o con apt-get

    Ora iniziamo con l'installazione, sempre dalla nostra solita root digitiamo:

    wget http://aleron.dl.sourceforge.net/sou...e-2.4.6.tar.gz

    export PHP_PREFIX="/usr"

    $PHP_PREFIX/bin/phpize

    ./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config

    // (dovete specificare il prefisso reale dove PHP è installato.. Può essere "/usr ""/usr/local", o altro )

    make

    make install

    Turck MMCache può essere installato sia come estensione di PHP o come estensione di Zend, in modo da dovr pubblicare il vostro codice solo in php.ini (solitamente/etc/php.ini).
    Per installare come estensione di Zend:

    Codice:
     zend_extension="/usr/lib/php4/mmcache.so"
    mmcache.shm_size="16"
    mmcache.cache_dir="/tmp/mmcache"
    mmcache.enable="1"
    mmcache.optimizer="1"
    mmcache.check_mtime="1"
    mmcache.debug="0"
    mmcache.filter=""
    mmcache.shm_max="0"
    mmcache.shm_ttl="0"
    mmcache.shm_prune_period="0"
    mmcache.shm_only="0"
    mmcache.compress="1"
    Per installarlo come estensione PHP

    Codice:
     extension="mmcache.so"
    mmcache.shm_size="16"
    mmcache.cache_dir="/tmp/mmcache"
    mmcache.enable="1"
    mmcache.optimizer="1"
    mmcache.check_mtime="1"
    mmcache.debug="0"
    mmcache.filter=""
    mmcache.shm_max="0"
    mmcache.shm_ttl="0"
    mmcache.shm_prune_period="0"
    mmcache.shm_only="0"
    mmcache.compress="1"
    // Potreste aver bisogno di copiare mmcache.so nei percorsi specificati... ripeto *potreste*

    Ora non vi resta altro da fare che creare una directory dove MMcache salverà la sua cache:

    mkdir /tmp/mmcache
    chmod 0777 /tmp/mmcache

    Ora riavviare apache con:

    service httpd restart
    oppure con
    /etc/rc.d/init.d/httpd restart


    Modifichiamo il file sysctl.conf

    Modificando questo file potreste avere una grossa spinta, non viene editato spesso questo file ma su un test fatto su un Dual Xeon 2.8Ghz il carico è diminuito del 10% circa.

    Sempre loggati da root digitare:

    cp /etc/sysctl.conf /etc/sysctl.conf.bak
    pico /etc/sysctl.conf

    e sostituire il contenuto del file con questo:

    Codice:
     # Kernel sysctl configuration file for Red Hat Linux
    #
    # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
    # sysctl.conf(5) for more details.
    
    # Disables packet forwarding
    net.ipv4.ip_forward=0
    
    # Disables IP source routing
    net.ipv4.conf.all.accept_source_route = 0
    net.ipv4.conf.lo.accept_source_route = 0
    net.ipv4.conf.eth0.accept_source_route = 0
    net.ipv4.conf.default.accept_source_route = 0
    
    # Enable IP spoofing protection, turn on source route verification
    net.ipv4.conf.all.rp_filter = 1
    net.ipv4.conf.lo.rp_filter = 1
    net.ipv4.conf.eth0.rp_filter = 1
    net.ipv4.conf.default.rp_filter = 1
    
    # Disable ICMP Redirect Acceptance
    net.ipv4.conf.all.accept_redirects = 0
    net.ipv4.conf.lo.accept_redirects = 0
    net.ipv4.conf.eth0.accept_redirects = 0
    net.ipv4.conf.default.accept_redirects = 0
    
    # Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
    net.ipv4.conf.all.log_martians = 0
    net.ipv4.conf.lo.log_martians = 0
    net.ipv4.conf.eth0.log_martians = 0
    
    # Disables IP source routing
    net.ipv4.conf.all.accept_source_route = 0
    net.ipv4.conf.lo.accept_source_route = 0
    net.ipv4.conf.eth0.accept_source_route = 0
    net.ipv4.conf.default.accept_source_route = 0
    
    # Enable IP spoofing protection, turn on source route verification
    net.ipv4.conf.all.rp_filter = 1
    net.ipv4.conf.lo.rp_filter = 1
    net.ipv4.conf.eth0.rp_filter = 1
    net.ipv4.conf.default.rp_filter = 1
    
    # Disable ICMP Redirect Acceptance
    net.ipv4.conf.all.accept_redirects = 0
    net.ipv4.conf.lo.accept_redirects = 0
    net.ipv4.conf.eth0.accept_redirects = 0
    net.ipv4.conf.default.accept_redirects = 0
    
    # Disables the magic-sysrq key
    kernel.sysrq = 0
    
    # Decrease the time default value for tcp_fin_timeout connection
    net.ipv4.tcp_fin_timeout = 15
    
    # Decrease the time default value for tcp_keepalive_time connection
    net.ipv4.tcp_keepalive_time = 1800
    
    # Turn off the tcp_window_scaling
    net.ipv4.tcp_window_scaling = 0
    
    # Turn off the tcp_sack
    net.ipv4.tcp_sack = 0
    
    # Turn off the tcp_timestamps
    net.ipv4.tcp_timestamps = 0
    
    # Enable TCP SYN Cookie Protection
    net.ipv4.tcp_syncookies = 1
    
    # Enable ignoring broadcasts request
    net.ipv4.icmp_echo_ignore_broadcasts = 1
    
    # Enable bad error message Protection
    net.ipv4.icmp_ignore_bogus_error_responses = 1
    
    # Log Spoofed Packets, Source Routed Packets, Redirect Packets
    net.ipv4.conf.all.log_martians = 1
    
    # Increases the size of the socket queue (effectively, q0).
    net.ipv4.tcp_max_syn_backlog = 1024
    
    # Increase the tcp-time-wait buckets pool size
    net.ipv4.tcp_max_tw_buckets = 1440000
    
    # Allowed local port range
    net.ipv4.ip_local_port_range = 16384 65536
    Ora fate CTRL + X per uscire e salvare il file
    Per far entrare in funzione i vostri cambiamenti immediatamente fare:

    /sbin/sysctl -p

    Potete guardare il carico del vostro server con il comando "uptime" da SSH.

    Fine Guida
    --------------------------------

    Spero che questi consigli vi siano serviti, attendo vostre opinioni, magari ho sbagliato qualcosa, visto che non sono molto esperto del settore

    Salutiiiii



  2. #2
    Appassionato L'avatar di MaxX
    Data Registrazione
    Feb 2006
    Messaggi
    153
    Wow... good Luca
    Grazie, apportero queste modifiche al più presto :P

  3. #3
    Webhosting Guru L'avatar di daniele_dll
    Data Registrazione
    Feb 2006
    Località
    Qualcuno dice Sicilia, qualche altro Nord Africa
    Messaggi
    1,535
    consiglio: mettete su eAccelerator, non turk mmcache. Quest'ultimo contiene particolari patch che correggono svariati bug

  4. #4
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    Salve a tutti,
    ho provato ad installare prima MMCache e poi (dopo aver letto il consiglio di daniele_dll) eAccelerator, ma essendo le mie conoscenze di linux molto limitate mi son subito bloccato.

    Premetto che ho un'installazione "liscia" della Fedora hosting su un Virtuo.

    Ho installato autoconf, automake e libtool dato che dovrebbero essere richiesti per l'installazione; oltre a questi ho dovuto installare anche il gcc.

    Lanciata la stringa
    Codice:
     ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
    mi viene restituito il seguente errore:
    Codice:
    [root@81-174-30-99 eaccelerator-0.9.4]# ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
    checking build system type... x86_64-redhat-linux-gnu
    checking host system type... x86_64-redhat-linux-gnu
    checking for egrep... grep -E
    checking for a sed that does not truncate output... //bin/sed
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ANSI C... none needed
    checking whether gcc and cc understand -c and -o together... yes
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking for PHP prefix... /usr
    checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend
    checking for PHP extension directory... /usr/lib/php4
    checking for re2c... exit 0;
    checking for gawk... gawk
    checking whether to enable eaccelerator support... yes, shared
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for unistd.h... (cached) yes
    checking limits.h usability... yes
    checking limits.h presence... yes
    checking for limits.h... yes
    checking sys/param.h usability... yes
    checking sys/param.h presence... yes
    checking for sys/param.h... yes
    checking sched.h usability... yes
    checking sched.h presence... yes
    checking for sched.h... yes
    checking mandatory system headers... yes
    checking whether union semun is defined in sys/sem.h... no
    checking for sysvipc shared memory support... yes
    checking for mmap shared memory support... yes
    checking for mmap on /dev/zero shared memory support... yes
    checking for anonymous mmap shared memory support... yes
    checking for posix mmap shared memory support... no
    checking for best shared memory type... sysvipc
    checking for spinlock semaphores support... yes
    checking for pthread semaphores support... no
    checking for posix semaphores support... no
    checking for sysvipc semaphores support... yes
    checking for fcntl semaphores support... yes
    checking for flock semaphores support... yes
    checking for best semaphores type... spinlock
    checking for sched_yield... yes
    checking for mprotect... yes
    checking for ext/session/php_session.h... yes
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for /usr/bin/ld option to reload object files... -r
    checking for BSD-compatible nm... /usr/bin/nm -B
    checking whether ln -s works... yes
    checking how to recognise dependent libraries... pass_all
    checking dlfcn.h usability... yes
    checking dlfcn.h presence... yes
    checking for dlfcn.h... yes
    checking for g++... no
    checking for c++... no
    checking for gpp... no
    checking for aCC... no
    checking for CC... no
    checking for cxx... no
    checking for cc++... no
    checking for cl... no
    checking for FCC... no
    checking for KCC... no
    checking for RCC... no
    checking for xlC_r... no
    checking for xlC... no
    checking whether we are using the GNU C++ compiler... no
    checking whether g++ accepts -g... no
    checking how to run the C++ preprocessor... /lib/cpp
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details.
    Il config.log è lungo 1km... penso che una parte interessante possa essere questa:
    Codice:
      $ ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-conf
    ig
    
    ## --------- ##
    ## Platform. ##
    ## --------- ##
    
    hostname = 81-174-30-99.vps.virtuo.it
    uname -m = x86_64
    uname -r = 2.4.20-021stab028.731.777-smp
    uname -s = Linux
    uname -v = #1 SMP Thu Dec 22 18:14:30 MSK 2005
    
    /usr/bin/uname -p = unknown
    /bin/uname -X     = unknown
    
    /bin/arch              = x86_64
    /usr/bin/arch -k       = unknown
    /usr/convex/getsysinfo = unknown
    hostinfo               = unknown
    /bin/machine           = unknown
    /usr/bin/oslevel       = unknown
    /bin/universe          = unknown
    Dovendo azzardare un'ipotesi credo sia un problema dovuto al fatto che le macchine hanno processori a 64bit, mentre l'OS è a 32...
    Voi che ne dite?
    Mi sapete indicare una soluzione per compilare correttamente eAccelerator?

    Dovendolo usare esclusivamente per hostare un sito di ecommerce vorrei cercare di sistemare al meglio apache & co.

    Se inoltre avete qualche buon consiglio sulla sicurezza date uno sguardo QUI...
    Ultima modifica di JD82; 24-02-2006 alle 01:49

  5. #5
    Webhosting Guru L'avatar di daniele_dll
    Data Registrazione
    Feb 2006
    Località
    Qualcuno dice Sicilia, qualche altro Nord Africa
    Messaggi
    1,535
    devi postare la parte finale del config.log

    almeno posta l'ultimo migliaio di righe, altrimenti non so

    cmq ... se fallisce li motivo credo sia semplice ...

    checking for g++... no
    checking for c++... no
    checking for gpp... no
    checking for aCC... no
    checking for CC... no
    checking for cxx... no
    checking for cc++... no
    quelli sono i vari compilatori ... ciò vuol dire che non hai i pacchetti installati per compilare ... e siccome installare tutto a mano è un suicidio fai un bel yum install php-devel ... cosi ti installa tuttò il necessario (credo) per compilare

  6. #6
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    Ho installato php-devel, ma non mi ha preso in automatico i vari compilatori

    Ti allego qui sotto il config.log

    Ma dici che il fatto dell'architettura non centra nulla? Perché prima di installare gcc mi falliva dando come errore l'assenza proprio di gcc... ora invece se la prende con delle librerie, ignorando l'assenza degli altri compilatori, o almeno così mi è parso di capire...
    File Allegati File Allegati

  7. #7
    Webhosting Guru L'avatar di daniele_dll
    Data Registrazione
    Feb 2006
    Località
    Qualcuno dice Sicilia, qualche altro Nord Africa
    Messaggi
    1,535
    guarda ... io ho tutto a 32bit e non aggiornerò nulla a 64 xche non ho yum e perché ho un botto di roba compilata a mano

    passerò al soft a 64bit quando piallo tutto, ovvero tra qualche mesetto

    ---

    Syntax error
    configure:6499: /lib/cpp conftest.cc
    cpp: installation problem, cannot exec `cc1plus': No such file or directory
    configure:6505: $? = 1
    configure: failed program was:


    per l'appunto

    devi installare i pacchetti del gcc, gpp, cpp, c, c++ e tanta altra roba

  8. #8
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    Ehm, ma perché io ho l'OS a 64? La fedora Core 2 se non erro è a 32, sbaglio?

    Ops! non avevo letto la fine
    mmm e con yum è un casino immagino... ho provato a scrivere yum install gpp ma dice che nn trova nulla

  9. #9
    Webhosting Guru L'avatar di daniele_dll
    Data Registrazione
    Feb 2006
    Località
    Qualcuno dice Sicilia, qualche altro Nord Africa
    Messaggi
    1,535
    la fc2 è a 32bit ma c'è anche la 64

    prova g++ e gcc

  10. #10
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    gcc già installato, g++ non lo trova, ora cerco un po su goooogle, magari son fortunto :P

    Aggiornamento:
    Questo comando dovrebbe funzionare:
    Codice:
    yum install gcc-c++
    ora lo provo...

    Aggiornamento2:
    Non ci credo, configurato!!
    Ora compilo e poi vi faccio sapre: )
    Ultima modifica di JD82; 24-02-2006 alle 10:55

  11. #11
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    Mannaggia, strano che non è andato tutto liscio!

    compilato tutto ok, vado a modificare il php.ini ma... non ho ben chiaro dove scrivere questo:
    Codice:
    extension="/ea/eaccelerator-0.9.4/modules/eaccelerator.so"
    eaccelerator.shm_size="16"
    eaccelerator.cache_dir="/tmp/eaccelerator"
    eaccelerator.enable="1"
    eaccelerator.optimizer="1"
    eaccelerator.check_mtime="1"
    eaccelerator.debug="0"
    eaccelerator.filter=""
    eaccelerator.shm_max="0"
    eaccelerator.shm_ttl="0"
    eaccelerator.shm_prune_period="0"
    eaccelerator.shm_only="0"
    eaccelerator.compress="1"
    eaccelerator.compress_level="9"
    QUI ho letto che va dopo ;Windows Extensions, ma proprio non trovo questo commento... Così ho deciso di ficcarlo sotto Dynamic Extension.
    (credo che poi al php non gli importi più di tanto dove vado a mettere ste robe...).
    In /ea/eaccelerator-0.9.4/modules/ è presente il file eaccelerator.so
    La dir /tmp/eaccelerator/ è creata e ha i permessi 777...

    Ho riavviato apache (service httpd restart) e il sito funziona, ma se lancio eaccelerator.php (che serve a verificare il corretto funz del plugin) mi dice che non è intallato
    Codice:
    <?php
    if (function_exists("eaccelerator")) {
      eaccelerator();
    } else {
      echo "<html><head><title>eAccelerator</title></head><body><h1 align=\"center\">eAccelerator is not installed</h1></body></html>";
    }
    ?>
    E inoltre la dir /tmp/eaccelerator/ è vuota

    Qualche consiglio??

    C'è un log dove poter leggere se c'è stato qualche errore nel caricamento del plugin?

  12. #12
    Webhosting Guru L'avatar di daniele_dll
    Data Registrazione
    Feb 2006
    Località
    Qualcuno dice Sicilia, qualche altro Nord Africa
    Messaggi
    1,535
    il log di apache, dai un'occhio al log di apache ... x quanto riguarda la configurazione ... non usare

    extension="............."

    ma

    zend_extension="............."

    inoltre devi sistemare il percorso presente in extension altrimenti non carica la libreria

    hai fatto il make && make install? se si vai a vedere dove l'ha messa (dovrebbe stare tra le estensioni di php)

  13. #13
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75
    Mitticcooo!!! Aggiungendo zend_ ha funzionato subito!!
    Ora preparo un bel how-to dettagliato su come installarlo

  14. #14
    HT Member
    Data Registrazione
    Feb 2006
    Messaggi
    75

    Arrow

    OK! how-to pronto! QUI c'è tutta la spiegazione su come installare eAccelerator su un virtuo con Fedora hosting + Plesk!

Discussioni Simili

  1. ottimizzare vps
    Di marika82 nel forum VPS - Virtual Private Server
    Risposte: 3
    Ultimo Messaggio: 14-02-2011, 09:14
  2. ottimizzare vps
    Di hosting-newbie nel forum VPS - Virtual Private Server
    Risposte: 14
    Ultimo Messaggio: 11-09-2010, 11:46
  3. [Webserver] Ottimizzare worker
    Di tesimanq nel forum Gestione Server Windows e Server Linux
    Risposte: 0
    Ultimo Messaggio: 20-02-2010, 12:33
  4. Ottimizzare mysql
    Di DarkJ nel forum Gestione Server Windows e Server Linux
    Risposte: 11
    Ultimo Messaggio: 07-09-2009, 16:11
  5. ottimizzare il my.cnf
    Di upshost nel forum Server dedicati, colocation, connettività e scelta data center
    Risposte: 3
    Ultimo Messaggio: 01-04-2009, 14:54

Informazioni Discussione

Utenti che Stanno Visualizzando Questa Discussione

Ci sono attualmente 1 utenti che stanno visualizzando questa discussione. (0 utenti e 1 ospiti)

Tag per Questa Discussione

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •