本文共 3092 字,大约阅读时间需要 10 分钟。
安装 Nginx 和相关扩展组件需要以下软件包:
nginx-1.0.9.tar.gz
nginx_upstream_hash.tar.gz
(Nginx Annunciator 模块)pcre-8.10.tar.gz
(PCRE 正则表达式库)php-5.3.6.tar.bz2
(PHP 5.3.6 版本)mysql-5.1.55.tar.gz
(MySQL 5.1.55 版本)mkdir -p /usr/local/nginx && cd /usr/local/nginx
tar -xzf nginx-1.0.9.tar.gztar -xzf nginx_upstream_hash.tar.gztar -xzf pcre-8.10.tar.gz
cd nginx-1.0.9patch -p0 < /usr/local/nginx/nginx_upstream_hash/nginx.patch
./configure --add-module=/usr/local/nginx/nginx_upstream_hash/ --with-pcre=/usr/local/nginx/pcre-8.10/ --prefix=/usr/local/nginx \ --with-http_stub_status_module --without-select_module --without-poll_module --with-http_realip_module \ --with-http_p_w_picpath_filter_module --with-http_gzip_static_module --with-http_random_index_module \ --with-http_perl_modulemake && make install
/etc/init.d/nginxd start
将以下内容保存至 /usr/local/nginx/conf/nginx.conf
:
location / { root /usr/local/nginx/html; index index.php index.html index.htm;}location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params;}
tar -xzf mysql-5.1.55.tar.gzcd mysql-5.1.55
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-shared --enable-static \ --with-comment --with-pthread --enable-assembler --with-mysqld-ldflags=-all-static --with-plugins=innobasemake && make install
cp support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldcp support-files/my-large.cnf /etc/my.cnfgroupadd mysqluseradd -g mysql mysqlchown -R mysql:mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --user=mysql
/etc/init.d/mysqld start|stop
yum -y install ntpdate pcre pcre-devel libjpeg-devel libpng libpng-devel freetype freetype-devel curl curl-devel \ compat-libgcc-296 zlib bzip2 bzip2-devel ncurses ncurses-devel openssl openssl-devel
tar -xjf php-5.3.6.tar.bz2cd php-5.3.6
./configure --disable-debug --enable-gd-native-ttf --with-freetype-dir=/usr/lib --enable-safe-mode \ --with-libxml-dir --with-mysql=/usr/local/mysql/ --with-gd --with-zlib-dir \ --with-jpeg-dir --with-png-dir --disable-posix --with-config-file-path=/etc \ --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-zip \ --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-curlwrappers --with-gettext \ --enable-shmop --enable-sockets --with-pdo-mysql=/usr/local/mysql/bin/mysql_config \ --with-mcrypt --with-curl --enable-ftpmake && make install
cp php.ini-production /etc/php.ini
/etc/init.d/phpcgi.sh start
cp -R /path/to/phpmyadmin˙files/* /usr/local/nginx/html/phpmyadmin
service nginx restartservice php restart
http://IP:80/phpmyadmin
,使用数据库账户登录。转载地址:http://jgwfk.baihongyu.com/