首页 > 代码库 > nginx安装
nginx安装
1. MySQL安装(同LAMP里面的安装方法)
2. php安装
wget http://cn2.php.net/distributions/php-5.4.36.tar.bz2
tar jxf php-5.4.36.tar.bz2
useradd -s /sbin/nologin php-fpm
cd php-5.4.36
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
拷贝启动脚本:cp /usr/local/src/php-5.4.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
make
make install
启动nginx:
/usr/local/nginx/sbin/nginx
4. 配置解析php
vim /usr/local/nginx/conf/nginx.conf //把下面的配置,前面的#删除,并更改fastcgi_param SCRIPT_FILENAME 那一行
复制代码重新加载 /usr/local/nginx/sbin/nginx -s reload
vim /usr/local/nginx/html/1.php
增加
<?php
phpinfo();
?>
测试: curl localhost/1.php
2. php安装
wget http://cn2.php.net/distributions/php-5.4.36.tar.bz2
tar jxf php-5.4.36.tar.bz2
useradd -s /sbin/nologin php-fpm
cd php-5.4.36
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
拷贝启动脚本:cp /usr/local/src/php-5.4.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
service php-fpm start
chkconfig php-fpm on
3. 安装nginx
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx --with-pcre
service php-fpm start
chkconfig php-fpm on
3. 安装nginx
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx --with-pcre
make
make install
启动nginx:
/usr/local/nginx/sbin/nginx
4. 配置解析php
vim /usr/local/nginx/conf/nginx.conf //把下面的配置,前面的#删除,并更改fastcgi_param SCRIPT_FILENAME 那一行
- location ~ \.php$ {
- root html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
- include fastcgi_params;
- }
vim /usr/local/nginx/html/1.php
增加
<?php
phpinfo();
?>
测试: curl localhost/1.php
文章来自http://www.aminglinux.com/bbs/thread-7316-1-1.html
nginx安装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。