Installing Nginx with php, mysql on OpenSUSE

:: What is
Please take a look at this.


:: Installing dependency
linux:~ # zypper in gcc gcc-c++ make termcap ncurses-devel libtool autoconf automake gd libxml2 libxml2-devel libxslt perl libmcrypt mhash libopenssl-devel libzip-util libzip-devel  libcurl-devel libjpeg-devel libpng-devel freetype2-devel libmcrypt-devel mhash-devel libbz2-devel openssl-devel pcre-devel zlib-devel


:: Installing Nginx 0.7.61

+ Download the package
linux:~ # mkdir download
linux:~ # cd download/
linux:~/download # wget http://sysoev.ru/nginx/nginx-0.7.61.tar.gz
linux:~/download # tar -xzf nginx-0.7.61.tar.gz

+ Compiling the package
linux:~/download # cd nginx-0.7.61/
linux:~/download/nginx-0.7.61 # groupadd nginx
linux:~/download/nginx-0.7.61 # useradd -s /bin/false -g nginx nginx
linux:~/download/nginx-0.7.61 # ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
linux:~/download/nginx-0.7.61 # make && make install


:: Installing MySQL 5.1.37

+ Download the package
linux:~ # cd download/
linux:~/download # wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.37.tar.gz/from/ftp://gd.tuwien.ac.at/db/mysql/
linux:~/download # tar -xzf mysql-5.1.37.tar.gz

+ Compiling the package
linux:~/download # cd mysql-5.1.37/
linux:~/download/mysql-5.1.37 # groupadd mysql
linux:~/download/mysql-5.1.37 # useradd -s /bin/false -g mysql mysql
linux:~/download/mysql-5.1.37 # ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-pthread
linux:~/download/mysql-5.1.37 # make && make install

+ Configuring MySQL Server
linux:~/download/mysql-5.1.37 # chgrp -R mysql /usr/local/mysql/
linux:~/download/mysql-5.1.37 # mkdir /usr/local/mysql/tmp
linux:~/download/mysql-5.1.37 # chmod 755 /usr/local/mysql/tmp/
linux:~/download/mysql-5.1.37 # /usr/local/mysql/bin/mysql_install_db --user=mysql
linux:~/download/mysql-5.1.37 # /usr/local/mysql/bin/mysqld_safe --user=mysql &
linux:~/download/mysql-5.1.37 # /usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'


:: Installing PHP 5.3.0

+ Downloading the package
linux:~ # cd download/
linux:~/download # wget http://id2.php.net/get/php-5.3.0.tar.bz2/from/de3.php.net/mirror
linux:~/download # tar -xjf php-5.3.0.tar.bz2

+ Compiling the package
linux:~/download # cd php-5.3.0/
linux:~/download/php-5.3.0 # ./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5/etc --disable-debug --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib --with-mcrypt --with-openssl --with-curl --enable-ftp --with-bz2 --with-mhash --enable-zip --with-pear --enable-libxml --enable-wddx --enable-sockets --enable-mbstring --enable-pcntl=20 --enable-bcmath --disable-ipv6 --with-mysqli=/usr/local/mysql/bin/mysql_config
linux:~/download/php-5.3.0 # make && make install

+ Configuring PHP
linux:~/download/php-5.3.0 # cp php.ini-production /usr/local/php5/etc/php.ini
linux:~/download/php-5.3.0 # vi /usr/local/php5/etc/php.ini
=[ configuring on this options : ]=
include_path = ".:/usr/local/php5/lib/php"
===========================


:: Configuring Nginx to PHP Support

+ Make fastcgi configuration file
linux:~ # vi /usr/local/nginx/conf/fastcgi.conf
=[ add this options : ]=
#fastcgi.conf
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

+ Add configuration for php file on nginx.conf
linux:~ # vi /usr/local/nginx/conf/nginx.conf
=[ add this config: ]=
location ~ \.php$ {
include /usr/local/nginx/conf/fastcgi.conf;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
}


:: Starting Nginx and FastCGI service
linux:~ # /usr/local/nginx/sbin/nginx
linux:~ # /usr/local/php5/bin/php-cgi -b 127.0.0.1:9000 -q &


:: Running all of them on booting
linux:~ # vi /etc/init.d/boot.local
=[ add these command :]=
/usr/local/mysql/bin/mysqld_safe &
/usr/local/nginx/sbin/nginx
/usr/local/php5/bin/php-cgi -b 127.0.0.1:9000 -q &
+++++++++++++++++++


:: Testink

+ Nginx server
Open your web browser and goto on : http://yourip/ or http://yourdomain.tld


+ PHP on Nginx
linux:~ # vi /usr/local/nginx/html/info.php
=[ add this example : ]=
<?php
phpinfo();
?>
Open your web browser and goto on url : http://yourip/info.php or http://yourdomain.tld/info.php



:: Links
+ GoogleLinux
+ NginxWiki

0 komentar:

Post a Comment

:: Cheap Web Hosting :: ~ only from Rp. 900/mo; 250Mb/mo of Bandwidth ~ :: Web Hosting Murah Meriah :: ~ mulai dari Rp. 900/bln; Bandwidth 250Mb/bln ~