LEMP: Difference between revisions
No edit summary |
No edit summary |
||
Line 192: | Line 192: | ||
<pre>nano /usr/share/nginx/www/info.php </pre> | <pre>nano /usr/share/nginx/www/info.php </pre> | ||
lisa read | lisa read: | ||
<pre> | <pre> | ||
Line 200: | Line 200: | ||
</pre> | </pre> | ||
salvesta ja välju | salvesta ja välju. | ||
taaskäivita nginx | taaskäivita nginx: | ||
<pre>service nginx restart</pre> | <pre>service nginx restart</pre> | ||
Line 209: | Line 209: | ||
Aadressilt "http://192.168.56.210/info.php" näed oma nginx ja php seadeid.(192.168.56.210 on serveri ip). | |||
LEMP komplekt on nüüd | LEMP komplekt on nüüd paigaltatud sinu serverisse. |
Revision as of 17:55, 24 May 2014
Linux, nginx (Engine x), MySQL, PHP (LEMP) komplekti paigaldamine Ubuntu 12.04 serverisse
Autor
Priit Lilleleht
VM masinad
näites kasutasin klientmasinat Ubuntu Desktop 12.04 (64bit) ja serverit Ubuntu-12.04-server-amd64.
näites kasutatud server:
RAM 512MB
HDD dynamically allocated 8GB
2 Võrgukaarti
- NIC1 - NAT (eth0 - Ubuntus)
- NIC2 - HostOnly (eth1 – Ubuntus) [192.168.56.210]
OS Ubuntu-12.04-server-amd64
paigaltatud SSH
Esimene samm
Selleks, et saada juurkasutajaks kasuta käsklust:
sudo -i
Uuendame kohalikud tarkvara repositooriumid.
apt-get update
Paigalda MySQL
MySQLi tarkvara paigaldamiseks kasuta Ubuntu serveri käsklust:
apt-get install mysql-server php5-mysql
MySQL root kasutaja parooli määramine. Antud näites:"password"
MySQLi aktiveerimine
mysql_install_db
lõpetuseks käivita skript:
/usr/bin/mysql_secure_installation
Küsitakse root kasutaja parooli, sisestage see.
Küsitakse, kas soovite vahetada root kasutaja parooli, vastake "N".
Järgmistele küsimustele vastake "Y". Pärast seda MySQL taaskäivitub ja rakendab muudatused.
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up...
Nginx paigaldamine
Paigaldan nginx:
apt-get install nginx
Nginx käivitamine, nginx ei käivitu automaatselt.
service nginx start
Kontrollimaks, et nginx töötab, suuna oma brauser serveri IP-aadressile (192.168.56.210).
PHP paigaldamine
apt-get install php5-fpm
PHP seadistamine
nano /etc/php5/fpm/php.ini
- rida
cgi.fix_pathinfo=1
- muuta reaks
cgi.fix_pathinfo=0
veel üks muudatus failis:
nano /etc/php5/fpm/pool.d/www.conf
- rida
listen = 127.0.0.1:9000
- muuta reaks
listen = /var/run/php5-fpm.sock
nginx seadistamine
nano /etc/nginx/sites-available/default
[...] server { listen 80; root /usr/share/nginx/www; index index.php index.html index.htm; server_name 192.168.56.210; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass the PHP scripts to FastCGI server listening on the php-fpm socket location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } [...]
- Muudatused.
- lisa index.php index rida.
- muuda "server_name" asendades "local host" kas domeeni nimega või IP-aadresiga (nt. 192.168.56.210).
- muuda vastavad read (location ~ \.php$ {) lõigus.
loo PHP infoleht
esmalt loo uus dokument
nano /usr/share/nginx/www/info.php
lisa read:
<?php phpinfo(); ?>
salvesta ja välju.
taaskäivita nginx:
service nginx restart
Aadressilt "http://192.168.56.210/info.php" näed oma nginx ja php seadeid.(192.168.56.210 on serveri ip).
LEMP komplekt on nüüd paigaltatud sinu serverisse.