nginx+php-fastcgi slackware 13.37

Sve u vezi mreža i povezivanja na Internet

Moderator: Urednik

Post Reply

Poznata ličnost
Poznata ličnost
offline
User avatar

Posts: 114
Joined: 14 Jan 2013, 09:52
Location: /dev/hda1, etc
Contact:

Post Napisano: 14 Jan 2013, 13:10


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

Code: Select all

tar zxf nginx.tar.gz
Zatim kopirati nginx-1.2.2.tar.gz u nginx folder koji smo malopre raspakovali:

Code: Select all

cp nginx-1.2.2 nginx/
zatim uci u folder nginx

Code: Select all

cd nginx
Pa slackbuild-u nginx-a promeniti dozvole u izvrsne:

Code: Select all

chmod +x nginx.SlackBuild
Pokrenuti slackbuild (imate dva nacina - jedan je):

Code: Select all

./nginx.SlackBuild
a drugi:
http://slackbuilds.org/slackbuilds/14.0 ... inx/README pogledajte tu...
zatim instalirati paket:

Code: Select all

installpkg /tmp/nginx-1.2.2-i486-1_SBo.tgz
DONE!
Nakon toga promenite dozvole rc.nginx-a u izvrsne:

Code: Select all

chmod +x /etc/rc.d/rc.nginx
Nakon toga pokrenite nginx servis:

Code: Select all

/etc/rc.d/rc.nginx start
DONE!!!!
Na adresi http://localhost se nalazi vas, za sad html sadrzaj!!!!

Code: Select all

nano /etc/nginx/nginx.conf
Sadrzaj:

Code: Select all

#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;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        #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;
        }
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    #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;
}

Code: Select all

nano /etc/rc.d/rc.php-cgi
Sadrzaj:

Code: Select all

#!/bin/sh
# /etc/rc.d/rc.php-cgi
# Start/stop/restart
# Da se php-cgi startuje automatski prilikom boot-a, ...
# u zvrsni:  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:

Code: Select all

chmod +x /etc/rc.d/rc.php-cgi
i:

Code: Select all

/etc/rc.d/rc.php-cgi start
DONE!!!

Code: Select all

nano /var/www/index.php
Sadrzaj:

Code: Select all

<?php echo 'radi :)'; ?>
Ako nam je, kao sto jeste, default user nginx-a "nobody", promeniti vlasnistvo u nobody:

Code: Select all

chown -R nobody:nobody /var/www
Na lokaciji:
http://localhost/index.php
se nalazi vasa php skripta :)

httpd(apache) - slekver 1337 --> WSI
phpmyadmin -slekver 1337 --> WSI



Administrator
Administrator
offline
User avatar

Posts: 4098
Joined: 04 Feb 2011, 20:32
Location: Beograd
Contact:

Post Napisano: 14 Jan 2013, 14:54


Sjajno! :) Pretekao si me i skinuo mi teret s grbače. Baš mi se ovih dana motala po glavi ideja da se napiše par članaka vezanih za setup nekoliko najpopularnijih web servera pod Slackom.

Imaš li iskustva sa lighttpd?



Poznata ličnost
Poznata ličnost
offline
User avatar

Posts: 114
Joined: 14 Jan 2013, 09:52
Location: /dev/hda1, etc
Contact:

Post Napisano: 14 Jan 2013, 15:04


Da, na debian-u, ali nije problem da ga poteram ni na slack-u ...
Sutra ili danas cu pokusati malko da eksperimentisem ... a httpd ima taj link ispod... ali i njega cu lepo doterati i postovati ... usput, spremam ovih dana malko opsirnija objasnjenja vezana za web servere na slack-u ... pa nije nikakav problem da ih podelim sa covecanstvom :) :) :) to je valjda i svrha otvorenog koda, da se ne krije nista od korisnika ;)



Administrator
Administrator
offline
User avatar

Posts: 4098
Joined: 04 Feb 2011, 20:32
Location: Beograd
Contact:

Post Napisano: 14 Jan 2013, 15:20


hightech wrote:Da, na debian-u, ali nije problem da ga poteram ni na slack-u ...
Sutra ili danas cu pokusati malko da eksperimentisem ... a httpd ima taj link ispod... ali i njega cu lepo doterati i postovati ...
Hvala. ;) Da dovršimo rundu. O Apaču smo malo pisali ranije.

hightech wrote:usput, spremam ovih dana malko opsirnija objasnjenja vezana za web servere na slack-u ... pa nije nikakav problem da ih podelim sa covecanstvom :) :) :) to je valjda i svrha otvorenog koda, da se ne krije nista od korisnika ;)
Odlično. :)


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest