一 、阿里云 centos 6.8 32 位裸环境

实现:Linux Nginx mysql php redis

查看当前安装的服务

[root@iZgahlk1l73998Z etc]# service --status-all
Aegis is running
status: Unknown job: agentwatch
atd (pid 1562) is running...
auditd (pid 1029) is running...
Checking for service cloud-init:Checking for service cloud-init:Checking for service cloud-init:Checking for service cloud-init:Checking for service cloud-init-upgrade:crond (pid 1547) is running...
Usage: /etc/init.d/ecs_mq-service {start|stop|restart}
Usage: /etc/init.d/eni-service {start|stop|restart}
ip6tables: Firewall is not running.
iptables: Firewall is not running.
irqbalance is stopped
iscsi is stopped
iscsid is stopped
lvmetad is stopped
dmeventd is stopped
mdmonitor is stopped
multipathd is stopped
netconsole module not loaded
Configured devices:
lo eth0
Currently active devices:
lo eth0
nscd is stopped
ntpd (pid 1434) is running...
master (pid 1525) is running...
rdisc is stopped
rsyslogd (pid 1051) is running...
sandbox is stopped
saslauthd is stopped
openssh-daemon (pid 1423) is running...

安装顺序是 Nginx > php> mysql>redis

查看:
[root@iZgahlk1l73998Z /]# rpm -qa |grep mysql
mysql-libs-5.1.73-8.el6_8.i686
卸载mysql
[root@iZgahlk1l73998Z /]# rpm -e mysql-libs-5.1.73-8.el6_8.i686 --nodeps
[root@iZgahlk1l73998Z /]# rpm -qa |grep php

1、安装编译工具和库文件

[root@iZgahlk1l73998Z /]# yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

2、安装PCRE

PCRE 作用是让 Nginx 支持 Rewrite 功能

下载 PCRE 安装包,下载地址: http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

[root@iZgahlk1l73998Z src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@iZgahlk1l73998Z src]# tar zxvf pcre-8.35.tar.gz

3、进入pcre 编译安装 默认安装 没有指定位置:

[root@iZgahlk1l73998Z pcre-8.35]# ./configure
[root@iZgahlk1l73998Z pcre-8.35]# make & make install

4、查看PCRE 版本

[root@iZgahlk1l73998Z pcre-8.35]#  pcre-config --version
8.35

安装Nginx:

1、下载 Nginx,下载地址:http://nginx.org/download/nginx-1.6.2.tar.gz

[root@iZgahlk1l73998Z src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@iZgahlk1l73998Z src]# tar zxvf nginx-1.6.2.tar.gz

2、安装

[root@iZgahlk1l73998Z nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@iZgahlk1l73998Z nginx-1.6.2]# make
[root@iZgahlk1l73998Z nginx]# /usr/local/webserver/nginx/sbin/nginx -v

3、配置Nginx.conf

创建运行Nginx 用户和用户组

groupadd nginx
useradd nginx -g nginx -s /sbin/nologin -M 或者在编译安装的时候指定,先创建
--with-user=nginx
--with-group=nginx
在编译Nginx.config的时候 记得使用
user nginx nginx;
#user  nobody;
user nginx nginx;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; # log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
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;
#charset koi8-r; server
{
listen 80;#监听端口
server_name localhost;#域名
index index.html index.htm index.php;
root /usr/local/webserver/nginx/html;#站点目录
location ~ .*\.(php|php5)?$
{
# fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$
{
expires 30d;
# access_log off;
}
location ~ .*\.(js|css)?$
{
expires 15d;
# access_log off;
}
access_log off;
} }

4、测试下

[root@iZgahlk1l73998Z conf]# /usr/local/webserver/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful

5、启动

[root@iZgahlk1l73998Z conf]# /usr/local/webserver/nginx/sbin/nginx
[root@iZgahlk1l73998Z conf]# ps -ef |grep nginx
root 21160 1 0 14:47 ? 00:00:00 nginx: master process /usr/local/webserver/nginx/sbin/nginx
nginx 21161 21160 0 14:47 ? 00:00:00 nginx: worker process
root 21163 1546 0 14:48 pts/0 00:00:00 grep nginx
/usr/local/webserver/nginx/sbin/nginx -s reload            # 重新载入配置文件
/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx
/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx

Linux 安装环境初始化检查 安装Nginx的更多相关文章

  1. Linux centos7环境下安装Nginx

    Linux centos7环境下安装Nginx的步骤详解 1.    首先到Nginx官网下载Nginx安装包 http://nginx.org/download/nginx-1.5.9.tar.gz ...

  2. Linux中编译、安装nginx

    Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP 代理服务器. Nginx 是由Igor Sysoev为俄罗斯访问 ...

  3. linux环境手动编译安装Nginx实践过程 附异常解决

    1.下载nginx源码包并解压 可在http://nginx.org/en/download.html下载.tar.gz的源码包,如(nginx-1.4.7.tar.gz) 或者使用云盘下载   ht ...

  4. linux系统虚拟机下安装nginx基础

    虽然安装nginx什么的 .以及如何配置等等一系列的资料案例已经很多了 但是作为菜鸟的我还是搞了半天哈 官网上面也有.但是一些细节方面的并没有说明.导致踩了半天坑才搞好 本案例的系统环境     wi ...

  5. 【Linux】Centos之安装Nginx及注意事项

    相关内容链接 [Linux]nginx常用命令 [nginx]详细配置说明 1.Nginx的简单说明 a.  Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务 ...

  6. linux系统或centos7安装nginx

    一.Linux下安装nginx 1.添加源 sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-cen ...

  7. Linux(CentOS7)安装Nginx(附简单配置)

    1. 安装make yum -y install gcc automake autoconf libtool make 2. 安装gcc yum -y install gcc gcc-c++ 3. 安 ...

  8. linux服务器使用yum安装nginx

    一,安装nginx和php-fpm yum install nginx php-fpm 二, 找到nginx.conf find / -name nginx.conf 三,添加解析php配置 在ser ...

  9. Linux之源码安装nginx,并按照作业一描述的那样去测试使用

    作业五:源码安装nginx,并按照作业一描述的那样去测试使用 [root@localhost nginx]# yum install gcc-* glibc-* openssl openssl-dev ...

随机推荐

  1. 简单聊聊TiDB中sql优化的一个规则---左连接消除(Left Out Join Elimination)

    我们看看 TiDB 一段代码的实现 --- 左外连接(Left Out Join)的消除; select 的优化一般是这样的过程: 在逻辑执行计划的优化阶段, 会有很多关系代数的规则, 需要将逻辑执行 ...

  2. 25 | MySQL是怎么保证高可用的?

    在上一篇文章中,我和你介绍了binlog的基本内容,在一个主备关系中,每个备库接收主库的binlog并执行. 正常情况下,只要主库执行更新生成的所有binlog,都可以传到备库并被正确地执行,备库就能 ...

  3. MongoDB 如何保证 oplog 顺序?

    MongoDB 复制集里,主备节点间通过 oplog 来同步数据,Priamry 上写入数据时,会记录一条oplog,Secondary 从 Primary 节点拉取 oplog并重放,以保证最终存储 ...

  4. uoj #139

    树链剖分//模板题由于存在换根操作对所有关于节点 u 的修改和查询操作进行分类讨论若 Root 在 u 的子树中,则不处理 u 所在的 Root 的那颗子树否则不会有影响寻找 Root 所在的那颗子树 ...

  5. [JLOI2013]卡牌游戏 概率DP

    [JLOI2013]卡牌游戏 概率DP 题面 \(dfs\)复杂度爆炸,考虑DP.发现决策时,我们只用关心当前玩家是从庄家数第几个玩家与当前抽到的牌是啥.于是设计状态\(f[i][j]\)表示有\(i ...

  6. 微信小程序--更换用户头像/上传用户头像/更新用户头像

    changeAvatar:function (){ var that=this; wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'c ...

  7. Oracle虚拟机 与 windows配置

    目录 相关资料 安装虚拟机及相关配置 安装PLSQL Developer Navicat Premium登录数据库 踩坑之路 相关资料 oracle虚拟机配置 提取码:s3sg 安装虚拟机及相关配置 ...

  8. 详谈mysqldump数据导出的问题

    1,使用mysqldump时报错(1064),这个是因为mysqldump版本太低与当前数据库版本不一致导致的. mysqldump: Couldn't execute 'SET OPTION SQL ...

  9. [Oracle] Oracle中和MySql的limit对应的方法

    MySql很贴心,有个限制范围查询的limit函数,用起来也很方便,SQL不用嵌套.如下: select id,name,age,cdate as ctime from emp order by id ...

  10. http-proxy-middleware及express实现反向代理

    $ npm install --save-dev http-proxy-middleware npm install express // 引用依赖 var express = require('ex ...