参考 https://blog.csdn.net/dyllove98/article/details/41120789

1,去官网下载最新的包

官网地址:http://nginx.org/download/

也可以直接 wget http://nginx.org/download/nginx-1.9.9.tar.gz (我这下载很慢所有直接去官网下,在上传到服务器)

2,下载相关依赖包

[root@localhost src] wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
[root@localhost src] tar zxvf pcre-8.40.tar.gz
[root@localhost src] cd pcre-8.40 [root@localhost pcre-8.40]# ./configure && make && make install 下面两个安装步骤和上面的一致
[root@localhost src] wget http://zlib.net/zlib-1.2.11.tar.gz [root@localhost src] wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz

3,解压nginx

tar zxvf nginx-1.9.9.tar.gz

cd nginx-1.9.9/
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module

4,编译nginx

  make && make install

添加一个nginx主程序的符号链接 
ln -sf /usr/local/nginx/sbin/nginx  /usr/sbin

检查配置是否正常

nginx -t

首先把原来的配置文件清空:

> /usr/local/nginx/conf/nginx.conf

“>” 这个符号之前阿铭介绍过,为重定向的意思,单独用它,可以把一个文本文档快速清空。

vim /usr/local/nginx/conf/nginx.conf

写入如下内容:
user nobody nobody;
worker_processes 2;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200; events
{
use epoll;
worker_connections 6000;
} http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 3526;
server_names_hash_max_size 4096;
log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'
'$host "$request_uri" $status'
'"$http_referer" "$http_user_agent"';
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 8 4k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
client_max_body_size 10m;
client_body_buffer_size 256k;
client_body_temp_path /usr/local/nginx/client_body_temp;
proxy_temp_path /usr/local/nginx/proxy_temp;
fastcgi_temp_path /usr/local/nginx/fastcgi_temp;
fastcgi_intercept_errors on;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_comp_level 5;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css text/htm application/xml; server
{
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html; location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
} } }

5,启动nginx

  /usr/local/nginx/sbin/nginx

  在检查下配置

  nginx -t

  查看nginx 是否启动

  ps -ef | grep nginx

6,测试

 php安装参考 : https://www.cnblogs.com/chancy/p/9238149.html

vim /usr/local/nginx/html/index.php

内容如下:
<?php
    echo phpinfo();
?>

												

liunx安装nginx的更多相关文章

  1. LIUNX 安装 nginx

    安装依赖 yum install gcc yum install pcre-devel yum install zlib zlib-devel yum install openssl openssl- ...

  2. liunx 利用nginx 实现负载均衡

    一般采用软件实现负载均衡的有Nginx.apache.nginx 近年来使用频繁,其官网上面显示可以承载5万并发访问量,太牛了. nginx 相比 apache优势明显:Nginx 服务程序比较稳定, ...

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

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

  4. (转)AIX7.1安装Nginx 1.13的方法

    原文:https://blog.csdn.net/lvshaorong/article/details/79401860 https://blog.csdn.net/lvshaorong/articl ...

  5. Liunx之nginx配置

    一.nginx安装 卸载yum安装的ngjnx yum remove nginx -y 编译安装nginx步骤 编译安装nginx的步骤 1.解决软件依赖 yum install gcc patch ...

  6. centos直接yum安装nginx

    Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便. 但是今天装了CentOS6.2,直接yum install nginx不行,要先处理下源,下面是安装完整流 ...

  7. 安装Nginx服务

    Nginx最大特点: 静态小文件(1M),支持高并发,同时占用系统资源很少.3W并发,10个进程,内存150M. Nginx特点: 1.配置简单,灵活,轻量. 2.高并发(静态小文件),静态几万的并发 ...

  8. Linux下安装nginx

    一直会使用nginx,也学习了好多nginx知识.也在本地安装过nginx,这次是第一次在正式的环境安装nginx,把这些记录下来总结经验. 一.安装环境 操作系统:CentOS release 6. ...

  9. centos系统编译安装nginx+php环境另加独立mysql教程

    以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...

随机推荐

  1. 5.04-requests_cookies

    import requests # 请求数据url member_url = 'https://www.yaozh.com/member/' headers = { 'User-Agent': 'Mo ...

  2. Maven打包相关插件集合

    参考:https://www.cnblogs.com/selier/p/9510326.html

  3. 网站建设部署与发布--笔记4-部署mysql

    部署MySQL 1.更新操作系统 $ yum update -y 2.安装mysql数据库,在CentOS 7.2 中,使用了mariadb替代了官方的mysql $ yum install mari ...

  4. java通过百度AI开发平台提取身份证图片中的文字信息

    废话不多说,直接上代码... IdCardDemo.java package com.wulss.baidubce; import java.io.BufferedReader; import jav ...

  5. 微信硬件平台(八) 4 ESP8266通过微信公众号给用户推送消息

    https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=自己申请微信公众号的TOKEN 输出结果:  由于aRDUINO串 ...

  6. SQLAlchemy中的自引用

    SQLALCHEMY采用adjacency list pattern来表示类的自引用. 例如,对于类Node自引用: class Node(Base): __tablename__='node' id ...

  7. jvm 年轻代、年老代、永久代

    关键字约定 Young generation –>新生代    Tenured / Old Generation –>老年代    Perm Area –>永久代 年轻代: 所有新生 ...

  8. OpenCV3计算机视觉Python语言实现笔记(五)

    图像的几何变换主要包括:平移.扩大与缩小.旋转.仿射.透视等等.图像变换是建立在矩阵运算基础上的,通过矩阵运算可以很快的找到对应关系. 1. 图像的平移 图像的平移,沿着x方向tx距离,y方向ty距离 ...

  9. 使用sql语句比较excel中数据的不同

    使用sql语句比较excel中数据的不同 我所在的项目组是一套物流系统,负责与公司的电商系统进行对接.但是公司的电商系统的省市区的配置和物流系统的省市区的配置有差异,所以需要找到这些差异. 首先找到我 ...

  10. python程序爬虫总是崩溃

    写的一个爬虫程序,主要用到以下库.但是伴随着代码增多,功能增多.经常性的程序崩溃现象,逐渐显现. pyqt5_5.8.2,requests.get,selenium+chorme,threading. ...