LEMP: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Plillele (talk | contribs)
No edit summary
Plillele (talk | contribs)
No edit summary
Line 45: Line 45:
<pre>/usr/bin/mysql_secure_installation</pre>
<pre>/usr/bin/mysql_secure_installation</pre>


Küsitakse root kasutaja parooli, sissestage see.
Küsitakse root kasutaja parooli, sisestage see.


Küsitakse kas soovite vahetada root kasutaja parooli, vastake N
Küsitakse kas soovite vahetada root kasutaja parooli, vastake N
Line 125: Line 125:


===nginx seadistamine===
===nginx seadistamine===


<pre>nano /etc/nginx/sites-available/default</pre>
<pre>nano /etc/nginx/sites-available/default</pre>
Line 174: Line 176:


::muda vastavat read "location ~ \.php$ {" lõigus
::muda vastavat read "location ~ \.php$ {" lõigus
===loo php info leht===
esmalt loo uus dokument
<pre>nano /usr/share/nginx/www/info.php </pre>
lisa read
<pre>
<?php
phpinfo();
?>
</pre>
salvesta ja välju
taaskäivita nginx
<pre>service nginx restart</pre>
Aadresilt http://192.168.56.210/info.php näed oma nginx ja php seateid:(192.168.56.210 on serveri ip.)
LEMP komplekt on nüüd paikaltatud sinu serverise.

Revision as of 16:57, 24 May 2014

Linux, nginx (Engine x), MySQL, PHP (LEMP) komplekti paigaltamine Ubuntu 12.04 serverisse

näites kasutame klient masinat Ubuntu Desktop 12.04 (64bit) ja serverit Ubuntu-12.04-server-amd64.

näites kasutatud server

RAM 512MB

HDD dynamicly allocated 8GB

2 Võrgukaarti

NIC1 - NAT (eth0 - Ubuntus)
NIC2 - HostOnly (eth1 – Ubuntus) [192.168.56.210]

OS Ubuntu-12.04-server-amd64


esimene samm

Selleks, et minna juurkasutajaks üle, kasuta käsklust.

sudo -i

Uuentame kohalikud tarkvara repositooriumid.

apt-get update


teine samm paigalda MySQL

MySQLi tarkvara paigaldamiseks kasuta Ubuntu serveri all käsklust

apt-get install mysql-server php5-mysql

MySQL root kasutaja parooli märamine. Antud näites: password


MySQLi aktiverimine

mysql_install_db

lõpetuseks joksuta 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

Paigaldame nginx

apt-get install nginx


Nginx käivitamine, nginx ei käivitu automatselt.

service nginx start

Kontrolimaks, 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 mutatus 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;
                
        }

}

[...]
Mutatused
lisa index.php index rita
muda server_name asentates local host kas domeni nimeka või IP-aadresiga (näite: 192.168.56.210)
muda vastavat read "location ~ \.php$ {" lõigus


loo php info leht

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


Aadresilt http://192.168.56.210/info.php näed oma nginx ja php seateid:(192.168.56.210 on serveri ip.)


LEMP komplekt on nüüd paikaltatud sinu serverise.