5th September 2015, 18:17
#2
2 out of 2 members found this post helpful.
Pasul 4. Configurarea Webserverului si Ajenti
Vom folosi Nginx, asa ca vom configura apache sa "asculte" alte porturi decat cele standard.
Pentru asta, e nevoie de urmatoarele 2 modificari (in fisierele ports.conf si default.conf din apache):
elproxy 2015-09-05 17-55-34.jpg
hostsapache.jpg
Pentru ca modificarile sa aiba efect, este nevoie sa dam "save", apoi restart serviciului apache - o putem face din partea de sus a paginii:
restart-apache.jpg
Urmeaza sa introducem parola de la mysql in Ajenti, pentru ca acesta sa poata crea baze de date:
configuremysql.jpg
Dupa ce apasati pe configure, lasati totul asa cum este, completati doar parola pe care ati pus-o la punctul 3, adica pentru userul "root" al bazei de date.
Apasati apoi pe OK, SAVE si RESTART
Pasul 5: Adaugarea site-urilor
Pentru inceput, mergeti la sectiunea "websites" si apasati pe "enable".
Apoi, adaugam primul site, dandu-i un nume intuitiv (de preferat chiar numele domeniului pe care dorim sa il adaugam):
creamsite.jpg
Apasam apoi pe "restart websites" (practic comanda aceasta da restart serviciului Nginx).
In acest moment, daca totul a mers bine, cand introducem in browser ip-ul VPS-ului, ar trebui sa vedem o pagina cu "service unavailable, maintenance mode".
Pentru ca site-ul sa functioneze, este nevoie sa il configuram, apasand pe "manage", in dreptul sau.
Am facut un video cu setarile necesare, cred ca este mai simplu de urmarit:
(daca cineva are de gand sa ma testeze cu parolele din video - le-am schimbat
)
Calea fisierelor este:
Cod:
/var/www/numesite/public_html
Userul si parola FTP le veti folosi pentru a accesa fisierele site-ului
Userul si parola bazei de date le veti folosi pentru a configura wordpress
Nginx nu foloseste .htaccess, asa ca este nevoie de corespondetul sau pentru nginx. Configuratia de mai jos este una recomandata PENTRU WORDPRESS chiar in tutorialele Ajenti si ar trebui sa functioneze pentru toti.
In tabul "Advanced", in partea de sus, puneti urmatoarele:
Cod:
# This order might seem weird - this is attempted to match last if rules below fail.
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|at om|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls |exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
client_max_body_size 100m;
Apoi fireste, Apply Changes si Restart Websites.
Avem acum totul pus la punct pentru a instala wordpress sau pentru a muta un site wordpress.
Pentru alte CMS-uri sau pentru artificii si redirecturi puteti gasi suficiente resurse de genul: htaccess to nginx converter
Ultima modificare făcută de Dan; 6th September 2015 la 03:17.