linux nginx php mysql 安装
来源:互联网 发布:淘宝卖家上传宝贝软件 编辑:程序博客网 时间:2024/05/22 02:18
陈永鹏的微博
陈永鹏的csdn博客地址:http://blog.csdn.net/chenyoper
陈永鹏的博客园地址:http://www.cnblogs.com/Yoperchen/
主要有三点:
安装nginx、安装php、安装mysql、整合nginx和php-fpm
【nginx】
1.安装
yum -y install nginx
完成之后
service nginx start
我第一次报错
Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
[FAILED]
解决办法:
vim /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
# listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html/weiyuekj;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
在红色字体处前面加#
2.启动
service nginx start
返回
Starting nginx: [ OK ]
现在就可以通过ip测试访问了,如无意外是nginx的默认页面
【mysql】
1.安装
yum install mysql mysql-server mysql-devel -y
完成之后
2.启动mysql
service mysqld start
3.设置新的密码并同时授权限
mysql> grant all on *.* to root@'%' identified by 'youpassword';
刷新使之生效
mysql> flush privileges;
退出
mysql> exit;
4.修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld]character_set_server=utf8init_connect='SET NAMES utf8'
【php】
1.下载php
2.解压php
3.进入php目录
./configure --prefix=/usr/local/php-5.4.4 --enable-fpm
make && make install
cp php.ini-production /usr/local/php-5.4.3/lib/php.ini
4.启动php-fpm
/usr/local/php5.4.3/sbin/php-fpm
【nginx和php-fpm整合】
修改nginx配置
cd /etc/nginx/conf.d
vim default.conf
加上如下(假设项目目录是myproject):
server { listen 80; server_name *.test.com; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html/myproject; index index.php index.html index.htm; } #error_page 404 /404.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/myproject; fastcgi_pass 127.0.0.1:9054; 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; } #deny file type location ~* \.(html|ini|docx|txt|doc|log|pem|pfx|cer)$ { deny all; }}
完美
作者:陈永鹏
邮箱:chen.yong.peng@foxmail.com
转载请注明作者陈永鹏CSDN博客地址:http://blog.csdn.net/chenyoper
零零糖
- Linux安装Nginx + MySQL + PHP
- linux 安装nginx php mysql
- Linux安装nginx,php,mysql
- linux安装nginx,mysql, php
- linux nginx php mysql 安装
- linux 安装nginx+php+mysql
- linux 安装nginx+php+mysql
- Linux下Nginx+PHP+Mysql安装,Nginx配置文件支持PHP
- linux,nginx,mysql,php安装备忘
- linux nginx+apache+php+mysql 安装配置
- Nginx+mysql+php 在linux上安装
- linux下nginx+mysql+php安装配置
- linux nginx+apache+php+mysql 安装配置
- linux下 php+nginx+mysql安装配置
- Linux LNMP安装 Nginx-Mysql-Php
- php+nginx+mysql安装
- 安装Nginx+PHP+Mysql
- nginx php mysql 安装
- FPGA驱动OLED动态显示(Verilog代码)——OLED初始化
- 如何在HTTPS 网页中引入HTTP资源: Mixed Content?
- 进程间的通信---(二)信号量
- 2. Linux文件、目录管理
- 「游戏引擎Mojoc」(1)简介
- linux nginx php mysql 安装
- 防火墙简介
- Clouder专项技能认证课程:网站建设——部署与发布
- 高并发下的抽奖优化
- Windows下安装python版的XGBoost(Anaconda)
- JavaScript中的原型与原型链
- 数据结构回顾——时间复杂度分析
- SylixOS高精度时钟分析
- 关于登录记住密码技术的小实现