Sada je: 25 tra 2024, 22:15.
Linux, poslužitelj, mreže i sigurnost

Moderator/ica: Moderatori/ce

Ovo bese malko mucno, ali se isplatilo (zahvlajujuci nesebicnoj pomoci clana shicy)

Pocnimo!!!
Odavde http://slackbuilds.org/repository/13.37/network/nginx/ skinuti :
Source Downloads:
nginx-1.2.2.tar.gz (53105bbe3ac9319db54d9eb46119695b)
Download SlackBuild:
nginx.tar.gz
Zatim otpakovati paket nginx.tar.gz
Kod: Označi sve
tar zxf nginx.tar.gz

Zatim kopirati nginx-1.2.2.tar.gz u nginx folder koji smo malopre raspakovali:
Kod: Označi sve
cp nginx-1.2.2 nginx/

zatim uci u folder nginx
Kod: Označi sve
cd nginx

Pa slackbuild-u nginx-a promeniti dozvole u izvrsne:
Kod: Označi sve
chmod +x nginx.SlackBuild

Pokrenuti slackbuild (imate dva nacina - jedan je):
Kod: Označi sve
./nginx.SlackBuild

a drugi:
http://slackbuilds.org/slackbuilds/14.0/network/nginx/README pogledajte tu...
zatim instalirati paket:
Kod: Označi sve
installpkg /tmp/nginx-1.2.2-i486-1_SBo.tgz

DONE!
Nakon toga promenite dozvole rc.nginx-a u izvrsne:
Kod: Označi sve
chmod +x /etc/rc.d/rc.nginx

Nakon toga pokrenite nginx servis:
Kod: Označi sve
/etc/rc.d/rc.nginx start

DONE!!!!
NA adresi http://localhost se nalazi vas sadrzaj!!!! Nisam editovao nginx.conf jer se podrazumeva da vec baratate ovim serverom... Dodacu, ali ne danas :)
Update: /etc/nginx/nginx.conf + /etc/rc.d/rc.php-cgi ....
Kod: Označi sve
nano /etc/nginx/nginx.conf

Sadrzaj:
Kod: Označi sve
#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   /var/www;
            index  index.html index.htm  index.php;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           /var/www;
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
             include        fastcgi_params;
        }
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;
    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_timeout  5m;
    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    include /etc/nginx/conf.d/*.conf;
}


Kod: Označi sve
nano /etc/rc.d/rc.php-cgi

Sadrzaj:
Kod: Označi sve
#!/bin/sh
# /etc/rc.d/rc.php-cgi
# Start/stop/restart
# Da se php-cgi startuje automatski prilikom boot-a, ...
# file executable:  chmod +x /etc/rc.d/rc.php-cgi
#
case "$1" in
  'start')
   echo "Starting php-cgi"
   /usr/bin/php-cgi -b 127.0.0.1:9000 &
  ;;
'stop')
    echo "Shutdown php-cgi"
    killall php-cgi
  ;;
  'restart')
    echo "Shutdown php-cgi....."
    killall php-cgi
    sleep 3
    echo "Starting php-cgi..."
    /usr/bin/php-cgi -b 127.0.0.1:9000 &
  ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
  ;;
esac

pa:
Kod: Označi sve
chmod +x /etc/rc.d/rc.php-cgi

i:
Kod: Označi sve
/etc/rc.d/rc.php-cgi start

DONE!!!
Kod: Označi sve
nano /var/www/index.php

Sadrzaj:
Kod: Označi sve
<?php echo 'radi :)'; ?>

Na lokaciji:
http://localhost/index.php
se nalazi vasa php skripta :)
... šta god da učiniš ... NISI DOBRO IZRAČUNAO ...
... for good fun and advanced thinking join WS1 ...
... do Boga je put dosta kratak, ne moras dalje od svog srca ...
Avatar
Postovi: 119
Postovi: 119
Pridružen/a: 21 vel 2013, 01:00
Lokacija: /dev/hda2, etc
Podijelio/la zahvalu: 24 puta
Primio/la zahvalu: 8 puta
Spol: M
OS: wheezy, slekver ;)
Na mreži
Trenutno korisnika/ca: / i 15 gostiju.