Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
| Entrambe le parti precedenti la revisioneRevisione precedente | |||
| linux:webserver:ampp_server [2019/08/14 16:36] – eliminata apressato | linux:webserver:ampp_server [2019/08/14 16:37] (versione attuale) – creata apressato | ||
|---|---|---|---|
| Linea 1: | Linea 1: | ||
| + | ====== AMPP Server ====== | ||
| + | |||
| + | ===== 1. Installazione base ===== | ||
| + | |||
| + | ===== 2. Installare il Server SSH ===== | ||
| + | |||
| + | Per installare il server SSH digitate | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt-get install ssh openssh-server | ||
| + | </ | ||
| + | |||
| + | Da questo punto in avanti è possibile usare un client SSH come [[http:// | ||
| + | |||
| + | ===== 3. Configurare la rete ===== | ||
| + | |||
| + | http:// | ||
| + | ===== 4. Aggiornare Linux (Opzionale) ===== | ||
| + | Digitare | ||
| + | <code bash> | ||
| + | per aggiornare il database dei package di '' | ||
| + | <code bash> | ||
| + | per installare gli ultimi apgrade (se esistono). | ||
| + | |||
| + | ===== 5. Cambiare la Shell di default (Opzionale) ===== | ||
| + | ///bin/sh// è un link simbolico (symlink) a /// | ||
| + | <code bash> | ||
| + | sudo ln -sf /bin/bash /bin/sh | ||
| + | </ | ||
| + | |||
| + | ===== 6. Disabilitare AppArmor ===== | ||
| + | AppArmor è un pacchetto che dovrebbe garantire la sicurezza. | ||
| + | In realtà, spesso, causa più problemi di quanti ne previene. | ||
| + | Deve essere fermato digitando | ||
| + | <code bash> | ||
| + | sudo / | ||
| + | sudo update-rc.d -f apparmor remove | ||
| + | </ | ||
| + | e disinstallato digitando | ||
| + | <code bash> | ||
| + | |||
| + | ===== 7. Installare il Software di Base ===== | ||
| + | Alcuni dei seguenti pacchetti sono propedeutici al completamento del server, altri servono solo per rendere la vita "piu facile" | ||
| + | <code bash> | ||
| + | sudo apt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libio-compress-perl libdb5.1-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential | ||
| + | sudo apt-get install mc imagemagick curl | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== 8. Installare MySQL ===== | ||
| + | Per installare MySQL digitare | ||
| + | <code bash> | ||
| + | sudo apt-get install mysql-server mysql-client | ||
| + | </ | ||
| + | |||
| + | Durante l' | ||
| + | Tale password è valida sia per l' | ||
| + | |||
| + | A fine installazione MySQL è attivo ma risponde solo per interrogazioni che provengono da '' | ||
| + | quindi necessitano di software come phpMyAdmin per lavorarci. \\ | ||
| + | Volendo poterci lavorare anche da altre postazioni è necessario modificare il file ''/ | ||
| + | |||
| + | <code bash> | ||
| + | sudo nano / | ||
| + | </ | ||
| + | < | ||
| + | [...] | ||
| + | # Instead of skip-networking the default is now to listen only on | ||
| + | # localhost which is more compatible and is not less secure. | ||
| + | # | ||
| + | [...] | ||
| + | </ | ||
| + | |||
| + | Riavviare MySQL | ||
| + | |||
| + | <code bash> | ||
| + | sudo / | ||
| + | </ | ||
| + | |||
| + | e verificare tramite il comando | ||
| + | |||
| + | <code bash> | ||
| + | sudo netstat -tap |grep mysql | ||
| + | </ | ||
| + | |||
| + | che la risposta sia come quella riportata di seguito | ||
| + | |||
| + | <cli prompt="#"> | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ===== 9. Installare il frontend Web ===== | ||
| + | |||
| + | ==== 9.1. Installare Apache ==== | ||
| + | |||
| + | Installare Apache digitando | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert | ||
| + | </ | ||
| + | |||
| + | ==== 9.2. Installare PHP5 / Python / Perl / Ruby ==== | ||
| + | |||
| + | === PHP5 === | ||
| + | |||
| + | Per installare PHP e gran parte delle sue librerie digitare | ||
| + | <code bash> | ||
| + | sudo apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php-pear | ||
| + | </ | ||
| + | |||
| + | Consiglio di aggiungere anche i seguenti moduli per i collegamenti con DB diversi da MySQL e per la grafica | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | === Python === | ||
| + | |||
| + | Per installare il modulo Python di Apache digitare | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | Potrebbe essere utile installare anche questi moduli | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | Per cercarne altri | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | |||
| + | === Perl === | ||
| + | |||
| + | Per installare il modulo Perl di Apache digitare | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | === Ruby === | ||
| + | |||
| + | Non ho fatto test su Ruby perché non lo conosco, per installarlo | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | |||
| + | ===== 10. Configurare il frontend Web ===== | ||
| + | |||
| + | ==== 10.1. Configurare di Apache ==== | ||
| + | <note important> | ||
| + | La parte seguente non è un must ... è la via che ho trovato io per fare funzionare tutto e per poter uploadare il sito in ftp. \\ | ||
| + | In parte è presa dalla [[https:// | ||
| + | </ | ||
| + | |||
| + | Creare un nuovo utente (potrebbe essere fatto anche sull' | ||
| + | Io lo chiamerò **webmaster**. | ||
| + | |||
| + | <code bash> | ||
| + | sudo adduser webmaster | ||
| + | </ | ||
| + | |||
| + | Dopo averne impostato la password aggiungerlo al gruppo '' | ||
| + | |||
| + | <code bash> | ||
| + | sudo usermod -g www-data webmaster | ||
| + | </ | ||
| + | |||
| + | Loggarsi con il nuovo utente | ||
| + | |||
| + | <code bash> | ||
| + | su webmaster | ||
| + | </ | ||
| + | |||
| + | e creare la seguente struttura di cartelle nella sua ''/ | ||
| + | |||
| + | <code bash> | ||
| + | mkdir public_html | ||
| + | mkdir public_html/ | ||
| + | mkdir backup | ||
| + | </ | ||
| + | |||
| + | Queste cartelle serviranno ad ospitare il sito ed il suo backup. | ||
| + | |||
| + | Tornare all' | ||
| + | |||
| + | <code bash> | ||
| + | exit | ||
| + | </ | ||
| + | |||
| + | cambiare il gruppo sulla cartella appena creata e riavviare il webserver | ||
| + | |||
| + | <code bash> | ||
| + | chgrp www-data / | ||
| + | service apache2 restart | ||
| + | </ | ||
| + | |||
| + | Se si ottiene un errore // | ||
| + | |||
| + | <code bash> | ||
| + | chmod 755 / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== 10.2. Configurazione dei linguaggi per il funzionamento con Apache ==== | ||
| + | |||
| + | === PHP === | ||
| + | Per poter usare PHP controllare che ''/ | ||
| + | |||
| + | <code bash> | ||
| + | sudo nano / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | SetHandler application/ | ||
| + | </ | ||
| + | < | ||
| + | SetHandler application/ | ||
| + | </ | ||
| + | # Per ri-abilitare php nelle directory utente commentare le righe seguenti | ||
| + | # (da < | ||
| + | # impedisce ai file .htaccess di disabilitarlo. | ||
| + | #< | ||
| + | # < | ||
| + | # php_admin_value engine Off | ||
| + | # </ | ||
| + | #</ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | === Python === | ||
| + | |||
| + | Esistono due modi per gestire il codice Python con Apache | ||
| + | * Il Publisher Handler -- Consente di scrivere scripts in puro Python ('' | ||
| + | * PSP Handler -- Python Server Pages, consentono di embeddare codice Python nell' | ||
| + | |||
| + | Perché Apache comprenda queste estensioni e le utilizzi in modo corretto è necessario editare il file '' | ||
| + | |||
| + | <code bash> | ||
| + | cd / | ||
| + | sudo nano python.conf | ||
| + | </ | ||
| + | |||
| + | e valorizzarlo come segue | ||
| + | |||
| + | < | ||
| + | < | ||
| + | AddHandler mod_python .py .psp | ||
| + | PythonHandler mod_python.publisher | .py | ||
| + | PythonHandler mod_python.psp | .psp | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | A questo punto è necessario attivare il modulo Python | ||
| + | <code bash> | ||
| + | |||
| + | Se dovesse risultare già attivo è necessario disattivarlo prima di procedere ad una nuova attivazione | ||
| + | <code bash> | ||
| + | o creare un link simbolico a '' | ||
| + | |||
| + | Potrebbe essere utile installare anche questi moduli | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | Per cercarne altri | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | |||
| + | === Perl === | ||
| + | |||
| + | Analogamente a quanto visto per Python è necessario creare il file '' | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | e valorizzarlo come segue | ||
| + | |||
| + | < | ||
| + | < | ||
| + | AddHandler perl-script .pl | ||
| + | PerlHandler ModPerl:: | ||
| + | PerlOptions +ParseHeaders | ||
| + | PerlSendHeader On | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Anche in questo caso il modulo deve essere attivato | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | |||
| + | ==== 10.3. Ultimi Ritocchi ==== | ||
| + | Perché tutto funzioni correttamente è necessario editare il file ''/ | ||
| + | <code bash> | ||
| + | e modificare la direttiva '' | ||
| + | |||
| + | < | ||
| + | < | ||
| + | # | ||
| + | DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Ora è necessario abilitare alcuni moduli di Apache | ||
| + | |||
| + | <code bash> | ||
| + | sudo a2enmod ssl | ||
| + | sudo a2enmod rewrite | ||
| + | sudo a2enmod suexec | ||
| + | sudo a2enmod include | ||
| + | sudo a2enmod userdir | ||
| + | </ | ||
| + | |||
| + | ed, in fine, è necessario riavviare Apache affinchè tutte le modifiche diventino effettive | ||
| + | |||
| + | <code bash> | ||
| + | sudo / | ||
| + | </ | ||
| + | |||
| + | o più velocemente | ||
| + | |||
| + | <code bash> | ||
| + | sudo service apache2 restart | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== 11. Primi Test ===== | ||
| + | |||
| + | Per verificare il corretto funzionamento di Apache è sufficiente spostarsi in ''/ | ||
| + | |||
| + | <code bash>su webmaster</ | ||
| + | |||
| + | ==== info.php ==== | ||
| + | Questo file verifica il corretto funzionamento di PHP mostrando la pagina informativa. | ||
| + | |||
| + | <code bash>vi info.php</ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | <?php phpinfo(); ?> | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Per testare aprire un bowser e puntare a **%%http:// | ||
| + | |||
| + | ==== test.py ==== | ||
| + | Questo file verifica il corretto funzionamento di Python in modalità Publisher Handler. | ||
| + | |||
| + | <code bash>vi test.py</ | ||
| + | < | ||
| + | def index(req): | ||
| + | return "Test successful"; | ||
| + | </ | ||
| + | |||
| + | Per testare aprire un bowser e puntare a **%%http:// | ||
| + | |||
| + | ==== test.psp ==== | ||
| + | Questo file verifica il corretto funzionamento di Python in modalità Python Server Pages. | ||
| + | |||
| + | <code bash>vi test.psp</ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Per testare aprire un bowser e puntare a **%%http:// | ||
| + | |||
| + | ==== printenv.pl ==== | ||
| + | Questo file verifica il corretto funzionamento di Perl come CGI e contrariamente agli altri deve essere posizionato in ''/ | ||
| + | |||
| + | <code bash>vi printenv.pl</ | ||
| + | < | ||
| + | # | ||
| + | ## | ||
| + | ## printenv -- demo CGI program which just prints its environment | ||
| + | ## | ||
| + | |||
| + | print " | ||
| + | foreach $var (sort(keys(%ENV))) { | ||
| + | $val = $ENV{$var}; | ||
| + | $val =~ s|\n|\\n|g; | ||
| + | $val =~ s|" | ||
| + | print " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Per testare aprire un bowser e puntare a **%%http:// | ||
| + | |||
| + | ===== 12. ProFTPD ===== | ||
| + | Per installare ProFTPD digitare | ||
| + | <code bash> | ||
| + | Il programma di installazione chiede di selezionare la modalità di funzionamento. \\ | ||
| + | Selezionare **standalone**. \\ | ||
| + | |||
| + | Editare il file '' | ||
| + | |||
| + | <code bash> | ||
| + | < | ||
| + | [...] | ||
| + | DefaultRoot ~ | ||
| + | IdentLookups off | ||
| + | ServerIdent on "FTP Server ready." | ||
| + | [...] | ||
| + | </ | ||
| + | |||
| + | Riavviare il servizio per rendere attive le modifiche | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | ===== xx. Postfix con SMTP-AUTH e TLS ===== | ||
| + | |||
| + | ===== 14. Sincronizzare l' | ||
| + | Poiché tutti i log e molte operazioni sono legate all' | ||
| + | è una buona idea tenere aggiornato l' | ||
| + | Per fare questo digitare | ||
| + | <code bash> | ||
| + | Ora l' | ||
| + | |||
| + | ===== 15. Applicazioni Web ===== | ||
| + | |||
| + | ==== phpMyAdmin ==== | ||
| + | phpMyAdmin è un database manager indispensabile per gestire MySQL (verranno fatti riferimenti ad esso nel corso della guida). \\ | ||
| + | Per installarlo digitare | ||
| + | <code bash> | ||
| + | |||
| + | Il programma di installazione effettuerà la configurazione automatica del webserver. | ||
| + | |||
| + | Selezionare **Apache2** (usando la barra spaziatrice e non l' | ||
| + | |||
| + | Per testarne il funzionamento è sufficiente aprire un borwser e farlo puntare a **%%http:// | ||
| + | |||
| + | ==== AWStats ==== | ||
| + | Questo software è un analizzatore del file '' | ||
| + | Genera grafici sulla fruizione delle pagine. | ||
| + | |||
| + | Per installarlo basta digitare | ||
| + | <code bash> | ||
| + | |||
| + | Se si vuole avere anche la geolocalizzazione dei visitatori installare anche | ||
| + | <code bash> | ||
| + | sudo apt-get install libnet-ip-perl | ||
| + | sudo apt-get install libgeo-ipfree-perl | ||
| + | </ | ||
| + | |||
| + | Il file di configurazione di AWStats si trova in ''/ | ||
| + | Viene fornito un template chiamato " | ||
| + | |||
| + | E' necessario creare una copia di '' | ||
| + | <code bash> | ||
| + | Successivamente modificare il nuovo file | ||
| + | <code bash> | ||
| + | e renderlo come segue: | ||
| + | < | ||
| + | # apache2 | ||
| + | LogFile="/ | ||
| + | |||
| + | # domain name | ||
| + | SiteDomain=" | ||
| + | HostAliases=" | ||
| + | |||
| + | LogFormat=1 | ||
| + | </ | ||
| + | |||
| + | Potete anche aggiungere le seguenti righe per attivare i plugins della geolocalizzazione | ||
| + | |||
| + | < | ||
| + | LoadPlugin=" | ||
| + | LoadPlugin=" | ||
| + | </ | ||
| + | |||
| + | Generare le prime statistiche (basate sul file '' | ||
| + | <code bash>/ | ||
| + | |||
| + | Dovreste ottenere un output simile a questo | ||
| + | <cli> | ||
| + | Create/ | ||
| + | From data in log file "/ | ||
| + | Phase 1 : First bypass old records, searching new record... | ||
| + | Searching new records from beginning of log file... | ||
| + | Phase 2 : Now process new records (Flush history on disk after 20000 hosts)... | ||
| + | Jumped lines in file: 0 | ||
| + | Parsed lines in file: 191338 | ||
| + | Found 0 dropped records, | ||
| + | Found 24 corrupted records, | ||
| + | Found 0 old records, | ||
| + | Found 191314 new qualified records. | ||
| + | </ | ||
| + | |||
| + | Creare il file ''/ | ||
| + | <code bash> | ||
| + | e copiarvi le seguenti linee | ||
| + | < | ||
| + | Alias / | ||
| + | Alias / | ||
| + | Alias /awstatscss "/ | ||
| + | ScriptAlias /cgi-bin/ / | ||
| + | ScriptAlias / | ||
| + | Options ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
| + | </ | ||
| + | |||
| + | Riavviare Apache | ||
| + | <code bash> | ||
| + | e verificare se tutto ha funzionato puntando il vostro browser su \\ | ||
| + | http:// | ||
| + | o \\ | ||
| + | http:// | ||
| + | se avere più files di configurazione. | ||
| + | |||
| + | Per rendere la generazione delle statistiche automatica è necessario mettere la chiamata per l' | ||
| + | <code bash> | ||
| + | ed aggiungere queste righe | ||
| + | < | ||
| + | # update every 10 min | ||
| + | */10 * * * * root / | ||
| + | </ | ||
| + | |||
| + | ^Riferimenti^ | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[http:// | ||
| + | |[[https:// | ||
| + | |[[http:// | ||
| + | |||
| + | ==== Dokuwiki ==== | ||
| + | |||
| + | <note important> | ||
| + | |||
| + | Esiste un package contenente '' | ||
| + | Quindi, impersonando '' | ||
| + | <code bash> | ||
| + | su - webmaster | ||
| + | wget http:// | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | tar -xvf ./ | ||
| + | mv / | ||
| + | |||
| + | exit | ||
| + | |||
| + | cd / | ||
| + | |||
| + | sudo chown -R www-data dokuwiki/ | ||
| + | |||
| + | sudo chgrp www-data dokuwiki/ | ||
| + | sudo chmod 775 dokuwiki/ | ||
| + | |||
| + | sudo chgrp www-data dokuwiki/ | ||
| + | sudo chmod 775 dokuwiki/ | ||
| + | |||
| + | </ | ||
| + | |||
| + | Puntare il browser su **%%http:// | ||
| + | |||
| + | ==== WordPress ==== | ||
| + | |||
| + | ==== phpBB3 ==== | ||
| + | |||
| + | ===== xx. Backups ===== | ||
| + | |||
| + | ===== xx. Links ===== | ||
| + | |||
| + | [[http:// | ||
| + | [[http:// | ||
| + | |||
| + | \\ | ||
| + | |||
| + | < | ||
| + | |||
| + | <note important> | ||
| + | |||
| + | ===== Rendere Accessibile la /var/www ===== | ||
| + | <code bash> | ||
| + | mkdir /home/[YOUR USERNAME]/ | ||
| + | mount --bind /var/www /home/[YOUR USERNAME]/ | ||
| + | </ | ||
| + | |||
| + | seguendo [[http:// | ||
| + | |||
| + | |||
| + | ===== Applicazioni Web ===== | ||
| + | |||
| + | WordPress | ||
| + | [[http:// | ||
| + | |||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | ===== Nuovi Appunti: 20091020 ===== | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | sudo cp -r -v tmp2/ | ||
| + | sudo cp -r -v tmp2/ | ||
| + | sudo cp -r -v tmp2/ | ||
| + | sudo cp -v tmp2/ | ||
| + | sudo cp -v tmp2/ | ||
| + | sudo chown -R root:root / | ||
| + | sudo chown -R root:root / | ||
| + | sudo chown -R www-data: | ||
| + | </ | ||
| + | |||
| + | ===== Nuovi Appunti: 20100120 ===== | ||
| + | |||
| + | [[http:// | ||
| + | \\ (Installazione in un colpo di tutto il software) | ||
| + | |||
| + | [[http:// | ||
| + | \\ (Utile per vedere alcune configurazioni) | ||
| + | |||
| + | [[http:// | ||
| + | \\ (Potenziale soluzione riguaro i permessi) | ||
| + | |||
| + | |||
| + | </ | ||

