Virtual Host Menggunakan Nginx

Published on May 2016 | Categories: Documents | Downloads: 9 | Comments: 0 | Views: 138
of 2
Download PDF   Embed   Report

Comments

Content

Virtual host menggunakan nginx (debian)

Posting sebelumnya ane membahas tentang virtual host menggunakan apache di OS debian lenny, sekarang kita coba membuat menggunakan nginx sebagai web server di debian squeeze. Seperti biasa pendukung lain virtual host memerlukan mysql,php dan lain-lain supaya nanti dapat berjalan. Sebelumnya untuk repo debian dapat sohib setting dulu di /etc/apt/sources.list Install nginx
#apt-get install nginx

Install MySQL 5
#apt-get install mysql-server mysql-client

Install PHP5
#apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-pspell php5recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Install phpmyadmin #apt-get install phpmyadmin Settingan virtual host buat file di /etc/nginx/sites-available/www.example.com (example ubah dengan nama domain sebenarnya) isi file www.example.com
server { server_name www.example.com; access_log /var/www/www.example.com/logs/access.log; error_log /var/www/www.example.com/logs/error.log; root /var/www/www.example.com; location / { index index.html index.htm index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params;

fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/www.example.com$fastcgi_script_name; } }

lalu buat symlink ke /etc/nginx/sites-enabled/www.example.com
#ln -s /etc/nginx/sites-available/www.example.com symlink ke /etc/nginx/sites-enabled/www.example.com

~ Optional ~ Untuk membuat virtual host phpmyadmin menjadi subdomain sehingga dapat diakses menggunakan url http://mysql.example.com buat file di /etc/nginx/sites-available/phpmyadmin isi file phpmyadmin
server { listen 80; server_name mysql.example.com; access_log /var/log/nginx/mysql.example.access_log; error_log /var/log/nginx/mysql.example.com.error_log warn; root /usr/share/phpmyadmin; index index.php; fastcgi_index index.php; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name; include /etc/nginx/fastcgi_params; }

kemudian buat direktori root /var/www/www.example.com
#mkdir /var/www/www.example.com

Restart nginx menggunakan perintah
#/etc/init.d/nginx restart

note : apabila file masih tidak dapat diakses di direktori root /var/www coba ubah permission file

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close