LAMP

Nginx的主要應用類別

1         使用Nginx結合FastCGI運行PHPJSP,Perl等程序

2         使用Nginx作反向代理,負載均衡,規則過濾

3         使用Nginx運行靜態HTML頁,圖片

4         Nginx與其他新技術的結合應用

安裝MySQL的方法:

1 使用RPM

2 使用二進制文件安裝

3 使用源代碼包安裝

安裝LEMP步驟:

安裝nginx

1 yum install gcc openssl-devel pcre-devel zlib-devel

2 groupadd nginx

3 useradd -g nginx -s /bin/false -M nginx

4 ./configure \

  --prefix=/usr \

  --sbin-path=/usr/sbin/nginx \

  --conf-path=/etc/nginx/nginx.conf \

  --error-log-path=/var/log/nginx/error.log \

  --http-log-path=/var/log/nginx/access.log \

  --pid-path=/var/run/nginx/nginx.pid  \

  --lock-path=/var/lock/nginx.lock \

  --user=nginx \

  --group=nginx \

  --with-http_ssl_module \

  --with-http_flv_module \

  --with-http_stub_status_module \

  --with-http_gzip_static_module \

  --http-client-body-temp-path=/var/tmp/nginx/client/ \

  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \

  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/

 

5 make && make install                                  

安裝MySQL

1 tar zxvf mysql-5.1.45-linux-i686-blibc23.tar.gz  -C /usr/local

2 cd /usr/local

3 ln –sv mysql-5.1.45-linux-i686-glibc23/  mysql

4 cd mysql

5 groupadd mysql

6 useradd –g mysql –s /sbin/nologin –M mysql

7 chown mysql:mysql  .  –R

8 scripts/mysql_install_db  --user=mysql

9 chown –R root .

10 chown –R mysql data

11 bin/mysql_safe  --user=mysql  &

12 vim /etc/profile (添加PATH=$PATH:/usr/local/bin)

13 . /etc/profile

14 vim /etc/ld.so.conf/mysql.conf(添加 /usr/local/mysql/lib)

15 ldconfig –v

16 ln –sv /usr/local/mysql/include  /usr/include/mysql

17 cp support-files/mysql.server  /etc/init.d/mysqld

18 chkconfig –add mysqld

19 chkconfig mysqld on

20 cp support-files/my-large.cnf /etc/my.cnf

21 service mysqld start

安裝PHP

 1 tar zxvf libevent-1.4.14b-stable.tar.gz

2 cd libevent-1.4.14b-stable

3 ./configure

4 make && make install

     5 tar zxvf libiconv-1.13.1.tar.gz

6 cd libiconv-1.13.1

7 ./configure

8 make && make install

9 tar jxvf php-5.3.3.tar.bz2

10 cd jxvf php-5.3.3

11 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm  --with-libevent-dir=/usr/local --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-iconv-dir=/usr/local

12 make ZEND_EXTRA_LIBS='-liconv'

13 make install

配置PHP

1 cp php.ini-production  /usr/local/php/etc/php.ini

2 cd /etc/local/php/etc

3 cp php-fpm.conf.default php-fpm.conf

4 vim php-fpm.conf(啓動 [global] pid  error_log   [www] listen.allowed_clients=127.0.0.1

pm.max_children   pm.start_servers  pm.max_spare_servers  pm.max_requests)

5 /usr/local/php/sbin/php-fpm  &

6 vim /etc/rc.d/rc.local(添加/usr/local/php/sbin/php-fpm)

7 vim /etc/nginx/nginx.conf

啓用如下選項:

location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

            include        fastcgi_params;

        }

8 service nginxd restart

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章