nginx+php+mysql环境

本文详细介绍了如何在服务器上安装并配置Nginx、PHP和Redis扩展,包括编译安装过程、配置文件修改及启动服务。

安装nginx

./configure --prefix=/data/nginx --with-http_ssl_module
make && sudo make install
sudo chown root /data/nginx/sbin/nginx
sudo chmod u+s /data/nginx/sbin/nginx

修改/data/nginx/conf/nginx.conf

location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
}
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|txt)$ {
            root           html/www.example.com;
            access_log        off;
            expires           30d;
}

启动nginx

sudo /data/nginx/sbin/nginx

安装php

./configure  --prefix=/data/php --enable-fpm --with-mysql --with-mysqli --with-pdo-mysql --enable-mysqlnd --with-openssl --with-gd --enable-gd-native-ttf
make && sudo make install
cp php.ini-production /data/php/etc/php.ini
cp /data/php/etc/php-fpm.conf.default /data/php/etc/php-fpm.conf
安装redis扩展
https://github.com/phpredis/phpredis#installation
phpize
./configure
make && make install
修改php.ini增加
extension=/data/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so

启动php

sudo /data/php/sbin/php-fpm -D -c /data/php/etc/php.ini
安装mysql
yum install mysql-server
service mysqld start
chkconfig mysqld on
chkconfig --list | grep mysqld
mysqladmin -u root password 'xxxxx'

转载于:https://www.cnblogs.com/hsjq/p/4696875.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值