1.首先更新环境

yum update

2.安装

yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libtool* zlib-devel libxml2-devel libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-devel gettext-devel curl curl-devel pam-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gzip make bzip2bzip2-devel pcre-devel wget ncurses-devel cmake make perl

3.安装mysql

sudo yum install mysql mysql-server

sudo /etc/init.d/mysqld restart

配置mysql:

sudo /usr/bin/mysql_secure_installation

会出现:

Enter current password for root (enter for none):

OK, successfully used password, moving on...

因为没有密码,所有直接按回车

下面的设置基本都是y

4

安装nginx

我的是CentOS 6,先执行:

rpm-ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

如果是CentOS 5,就用下面的源:

rpm-ivh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm

如果是Red Hat Enterprise Linux 6:

rpm -ivhhttp://nginx.org/packages/rhel/6/noarch/RPMS/nginx-release-rhel-6-0.el6.ngx.noarch.rpm

如果是Red Hat Enterprise Linux 5:

rpm -ivhhttp://nginx.org/packages/rhel/5/noarch/RPMS/nginx-release-rhel-5-0.el5.ngx.noarch.rpm

yum install nginx

service nginx start

查看内网ip地址命令:

ifconfig eth0 | grep inet | awk '{ print $2 }'

5

安装php

sudo yum install php-fpm php-mysql

配置php:

sudo vi /etc/php.ini

设置:cgi.fix_pathinfo=0

设置的原因为:If this number is kept as a 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path—a much safer alternative. Save and Exit.

6

配置nginx

sudo vi /etc/nginx/nginx.conf

打开后会发现:包含文件:/etc/nginx/conf.d/default.conf

然后:

sudo vi /etc/nginx/conf.d/default.conf

复制下面到文件:

server {

listen 80;

server_name example.com;

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;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

# 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;

}

}

把上面的:example.com换成IP或者网址,在目录/usr/share/nginx/html下增加index.php文件,里面添加内容,可以填写phpinfo查看参数

7

sudo vi /etc/php-fpm.d/www.conf

[...]

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user's group

;will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = nginx

; RPM: Keep a group allowed to write in log dir.

group = nginx

[...]

把上面出现的apache换成nginx

重启php-fpm

sudo service php-fpm restart

然后重启nginx

sudo service nginx restart

8

设置开机启动:

sudo chkconfig --levels 235 mysqld on

sudo chkconfig --levels 235 nginx on

sudo chkconfig --levels 235 php-fpm on

9

检测环境会发现:

You are missing the dom extension

You are missing the gd extension

You are missing the mcrypt extension

1

安装dom

sudo yum install php-xml

service php-fpm restart

2

安装gd

yum install php-gd3

安装mcrypt

i386

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

x86_64

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install php-mcrypt

10

修改配置文件:

1.

/etc/nginx/conf.d/default.conf

1.1修改

server_name 121.199.39.177 //ip

1.2

access_log /www/web_logs/access.log wwwlogs;

error_log /www/web_logs/error.log notice;

新建对应的文件,设置文件可写

1.3

把文件覆盖到/etc/nginx

打包下载地址:

http://download.csdn.net/download/terry_water/6966473

/etc/nginx/fcgi.conf

# nginx conf conf/fcgi.conf

# Created by http://www.wdlinux.cn

# Last Updated 2010.06.01

if ($request_filename ~* (.*)\.php) {

set $php_url $1;

}

if (!-e $php_url.php) {

#return 403;

}

fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param SERVER_SOFTWARE nginx;

fastcgi_param QUERY_STRING $query_string;

fastcgi_param REQUEST_METHOD $request_method;

fastcgi_param CONTENT_TYPE $content_type;

fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

fastcgi_param REQUEST_URI $request_uri;

fastcgi_param DOCUMENT_URI $document_uri;

fastcgi_param DOCUMENT_ROOT $document_root;

fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param REMOTE_ADDR $remote_addr;

fastcgi_param REMOTE_PORT $remote_port;

fastcgi_param SERVER_ADDR $server_addr;

fastcgi_param SERVER_PORT $server_port;

fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

/etc/nginx/conf.d/default.conf

server {

listen 80;

server_name 121.199.39.177;

root /usr/share/nginx/html;

server_tokens off;

include none.conf;

index index.php index.html index.htm;

access_log /www/web_logs/access.log wwwlogs;

error_log /www/web_logs/error.log notice;

location ~ \.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

expires 30d;

}

location ~ .*\.(js|css)?$ {

expires 12h;

}

}

/etc/nginx/nginx.conf

user nginx nginx;

worker_processes 1;

error_log /var/log/nginx/error.log warn;

pid /var/run/nginx.pid;

worker_rlimit_nofile 5120;

events {

use epoll;

worker_connections 5120;

}

http {

include /etc/nginx/mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 8m;

# limit_conn_zone $binary_remote_addr zone=one:32k;

sendfile on;

tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_buffers 8 128k;

fastcgi_connect_timeout 9900s;

fastcgi_send_timeout 9900s;

fastcgi_read_timeout 9900s;

gzip on;

gzip_min_length 1k;

gzip_buffers 4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types text/plain application/x-javascript text/css application/xml;

gzip_vary on;

log_format wwwlogs '$remote_addr - $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for';

include /etc/nginx/conf.d/*.conf;

}

/etc/nginx/none.conf

location / {

index index.html index.php; ## Allow a static html file to be shown first

try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler

expires 30d; ## Assume all files are cachable

}

## These locations would be hidden by .htaccess normally

location /app/ { deny all; }

location /includes/ { deny all; }

location /lib/ { deny all; }

location /media/downloadable/ { deny all; }

location /pkginfo/ { deny all; }

location /report/config.xml { deny all; }

location /var/ { deny all; }

location /var/email/ {allow all;}

location /var/export/ { ## Allow admins only to view export folder

auth_basic "Restricted"; ## Message shown in login window

auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword

autoindex on;

}

location /. { ## Disable .htaccess and other hidden files

return 404;

}

location @handler { ## Magento uses a common front handler

rewrite / /index.php;

}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler

rewrite ^(.*.php)/ $1 last;

}

magento php mysql,安装lnmp nginx php mysql环境 -magento相关推荐

  1. python django mysql安装_Django+Nginx+uWSGI+Mysql搭建Python Web服务器

    原标题:Django+Nginx+uWSGI+Mysql搭建Python Web服务器 安装的时候全部选择英文,记得以前选择中文的时候安装时出了问题,服务器组件一个不选,Ubuntu安装做的很贴心,基 ...

  2. mac php5.6 安装phalcon,Mac下安装LNMP(Nginx+PHP5.6)环境

    安装Homebrew 最近工作环境切换到Mac,所以以OS X Yosemite(10.10.1)为例,记录一下从零开始安装Mac下LNMP环境的过程 确保系统已经安装xcode,然后使用一行命令安装 ...

  3. Mac下安装LNMP(Nginx+PHP5.6)环境

    http://avnpc.com/pages/install-lnmp-on-osx 转载于:https://www.cnblogs.com/qichao123/p/7840255.html

  4. linux nginx编译安装mysql_Centos7下编译安装配置Nginx+PHP+MySql环境

    序言 这次玩次狠得.除了编译器使用yum安装,其他全部手动编译.哼~ 看似就Nginx.PHP.MySql三个东东,但是它们太尼玛依赖别人了. 没办法,想用它们就得老老实实给它们提供想要的东西. 首先 ...

  5. win安装nginx php mysql_win平台安装配置Nginx+php+mysql 环境

    1.准备工作 (1)PHP 版本5.6.17 下载地址  PHP官网  脚本之家 下载地址 (2)Nginx 版本1.8.0 下载地址  Nginx官网 脚本之家 下载地址 (3)MySQL 版本5. ...

  6. 4步搞定MySQL安装部署(附MySQL一键式部署脚本)

    墨墨导读:良好的开端是成功的一半,从MySQL安装开始. 学习数据库技术,实际动手的第一步是安装自己的MySQL.MySQL方面也提供多样式的安装方式rpm ,tar ,源码包.当安装完投入使用之后, ...

  7. mysql装不上怎么办_MySQL数据库之mysql安装不上怎么办 mysql安装失败原因和解决方法...

    本文主要向大家介绍MySQL数据库之mysql安装不上怎么办 mysql安装失败原因和解决方法了 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. mysql数据库安装不了了!my ...

  8. 数据库系统原理与应用教程(002)—— MySQL 安装与配置:MySQL 软件的卸载(windows 环境)

    数据库系统原理与应用教程(002)-- MySQL 安装与配置:MySQL 软件的卸载(windows 环境) 目录 数据库系统原理与应用教程(002)-- MySQL 安装与配置:MySQL 软件的 ...

  9. 数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)

    数据库系统原理与应用教程(001)-- MySQL 安装与配置:MySQL 软件的安装(windows 环境) 目录 数据库系统原理与应用教程(001)-- MySQL 安装与配置:MySQL 软件的 ...

最新文章

  1. Spring Boot 核心知识点总结,面试再也不怕了!
  2. 鸟哥linux群,【鸟哥的linux私房菜-学习笔记】linux的帐号与群组
  3. 极度随机树ExtraTreesClassifier
  4. 揭晓远程证明架构EAA:机密容器安全部署的最后一环 | 龙蜥技术
  5. JavaScript | 声明数组并使用数组索引分配元素的代码
  6. DEKR 解构式关键点回归(一):算法思想与原理
  7. python如何合并两个字典
  8. 单例对象会被jvm的gc时回收吗_【PHP设计模式】单例模式
  9. jieba的一些使用
  10. 拉普拉斯平滑处理介绍
  11. php对联广告,js 左右悬浮对联广告代码示例
  12. 二进制转四进制计算机,计算机进制转换方法
  13. Python实战,截图识别文字,过万使用量版本?
  14. 【干货】啦啦啦~再也不用担心webStorm激活码失效了
  15. matter.js学习笔记(八)--Composites.newtonsCradle()制造牛顿摆
  16. Ubuntu连接WIFI并开启热点
  17. 高效实现统计分析(按日,月,周)查询功能
  18. simplest_ffmpeg_streamer加注释版
  19. java文本框双击可编辑_JS实现双击内容变为可编辑状态
  20. 业务的转型能让大象重新跳舞吗?

热门文章

  1. 使用Jedit建立IDE图文教程
  2. HDOJ-1181 字符串首尾相连问题[DFS()+strcmp()]
  3. 前端服务器OWA 访问显示异常最佳解决方案
  4. Hadoop HDFS分布式文件系统 常用命令汇总
  5. Swift 3 网络请求+数据解析
  6. java中使用request,application,session,cookie对象
  7. 静静守候属于我们的幸福。坚守我们的约定
  8. TrueSec引导的Linux系统和安全检测工具预览
  9. IPTABLES简单应用说明和Linux下IPTABLES配置详解
  10. 测试无数据_无数据驱动自动化测试