linux centos 安装lnmp
来源:互联网 发布:稀奇古怪有趣的软件 编辑:程序博客网 时间:2024/06/04 19:10
nginx安装
步骤一
安装前必备准备工作
1 yum install -y gcc-c++ GCC编译器,可用来编译C语言程序,Nginx不会直接提供二进制可执行程序。
2 yum install -y pcre pcre-devel PCRE库,该库支持正则表达式,比如rewrite重写功能
3 yum install -y zlib zlib-devel zlib库,对HTTP包的内容做gzip的压缩
4 yum install -y openssl openssl-devel openSSL开发库,如果我们的服务器不只是需要HTTP,还需要更安全的SSL协议上传输HTTP,那么就需要openssl。另外如果我们想使用md5、SH1等散列函数,那么也需要安装它。
步骤二
让nginx认识php,如下:
1. 编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1
1. 编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1
2.修改/usr/local/nginx/conf/nginx.conf 添加如下代码
修改nginx配置文件,添加fastcgi支持
1、修改nginx.conf文件
vi /etc/nginx/nginx.conf
配置文件部分代码
路径是:/usr/share/nginx/html
- [...]
- server {
- listen 80;
- server_name _;
- #charset koi8-r;
- #access_log logs/host.access.log main;
- location / {
- root /usr/share/nginx/html;
- index index.php index.html index.htm;
- }
- error_page 404 /404.html;
- location = /404.html {
- root /usr/share/nginx/html;
- }
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- root /usr/share/nginx/html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- location ~ /\.ht {
- deny all;
- }
- }
- [...]
判断nginx配置文件修改的正确性:/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
启动nginx
启动nginx命令:/usr/local/nginx/sbin/nginx
平滑重启nginx命令:/usr/local/nginx/sbin/nginx -s reload
平滑停止nginx信念:/usr/local/nginx/sbin/nginx -s quit
nginx配置文件位置:/usr/local/nginx/conf/nginx.conf
php安装
yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy php-common php-devel php-fpm,没有安装php-fpm,后来yum install php-fpm
开启php-fpm命令是:service php-fpm start
关闭php-fpm命令是:service php-fpm stop
mysql安装
#yum -y install mysql mysql-server mysql-devel
配置mysql开机启动服务
#chkconfig --add mysqld (在服务清单中添加mysql服务)
#chkconfig mysqld on (设置mysql服务随开机启动)
#service mysqld start (启动mysql服务)
配置mysql开机启动服务
#chkconfig --add mysqld (在服务清单中添加mysql服务)
#chkconfig mysqld on (设置mysql服务随开机启动)
#service mysqld start (启动mysql服务)
然后就可以登录mysql了,命令是:mysql -uroot -p ,无密码直接回车就成
0 0
- linux centos 安装lnmp
- 基于centos安装LNMP
- Centos 6.2安装lnmp
- CentOS LNMP安装
- centos安装配置lnmp
- CentOS安装LNMP
- CentOS 7 安装lnmp
- CentOS 安装lnmp环境
- centos 安装 lnmp
- centos之lnmp 安装
- centos安装lnmp
- centos安装lnmp
- Centos 7 LNMP 安装
- centos 安装 lnmp 环境
- lnmp环境安装(1)-linux(centos)系统安装
- LNMP安装配置-linux Nginx/Mysql/Php/Phpmyadmin(CentOS vps)
- 阿里云centos 安装lnmp
- CentOS编译安装LNMP环境
- array_filter
- CSS solid 属性
- win8环境下sqlserver配置本机数据源报错53,17的一种可能解决方法
- Eclipse多项目依赖工程基于Gradle的多渠道打包脚本
- 笔记本链接蓝牙设备后还是笔记本在播放而不是蓝牙设备如何设置
- linux centos 安装lnmp
- gvim透明设置
- as3与js通信详解
- Difference between add(), replace(), and addToBackStack()
- 贪心算法--Packets
- 网络编程的OSI协议和TCP/IP协议
- poj 2828 树状数组or线段树(还原排队的人的序列)
- 缓存实例的不可变类
- linux socket 编程之 —— socket详解