Thursday, July 19, 2012

Cara Menginstall Atau Konfigurasi nginx,php,mysql Untuk Windows

Nginx Merupakan Sebuah Webserver Yang Penggunaan Resourcenya sangat Minim.
Sebelum Anda Menginstall Anda Perlu Download Dulu Bahannya :
 Setelah semua didownload , ekstrak folder nginx-1.3.0 dan rename ke nginx saja. kemudian masuk ke config nginx (%drive%:\nginx\conf\nginx.conf)

isi file config

Code:
#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   html;
            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           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$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;
    #    }
    #}

}
itu tinggal di copas aja, confignya sudah betul

Install php
--------------
install phpnya di path %drive%\nginx\php, soalnya kalo beda, nanti beda sama config versi diatas

Install mysql
-----------
install mysqlnya di path %drive%\nginx\mysql , soalnya kalo beda, nanti beda sama config versi diatas

terus di buat auto start servicenya

Install phpmadmin
------------------

Tinggal ekstrak aja filenya di %drive%\nginx\html\
trus rename folder ke phpmyadmin
================================================== ======

Setelah menyelesaikan semua tahap di atas, jangan lupa buat start server.vbs sama reload server.vbs





Code:
file start server.vbs
===================
Dim sh, fcgiPort, PHPini

fcgiPort = "127.0.0.1:9000"
PHPini = "%drive%:\nginx\php\php.ini"

Set sh = WScript.CreateObject("WScript.Shell")

' Navigate to the the nginx folder and run the server
sh.run "cmd /K CD %drive%:\nginx\ & start nginx", 0

' Navigate to the PHP folder and start the FastCGI executable
sh.run "cmd /K CD %rive%:\nginx\php\ & php-cgi.exe -b "& fcgiPort &" -c "& PHPini, 0

Set sh = Nothing
isi file reload server.vbs
Code:
Dim sh, fcgiPort, PHPini

fcgiPort = "127.0.0.1:9000"
PHPini = "%:\nginx\php\php.ini"

Set sh = WScript.CreateObject("WScript.Shell")

' Navigate to the the nginx folder and run the server
sh.run "cmd /K CD %:\nginx\ & reload nginx", 0

Set sh = Nothing
catatan:
%drive% = label harddisk tempat penginstallan (ex: c:\ d:\ e:\ f:\, dst)  

0 comments:

Post a Comment

Silahkan jika anda ingin komentar, namun tolong gunakan bahasa yang sopan.