liunx安装nginx
参考 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的更多相关文章
- LIUNX 安装 nginx
安装依赖 yum install gcc yum install pcre-devel yum install zlib zlib-devel yum install openssl openssl- ...
- liunx 利用nginx 实现负载均衡
一般采用软件实现负载均衡的有Nginx.apache.nginx 近年来使用频繁,其官网上面显示可以承载5万并发访问量,太牛了. nginx 相比 apache优势明显:Nginx 服务程序比较稳定, ...
- linux系统虚拟机下安装nginx基础
虽然安装nginx什么的 .以及如何配置等等一系列的资料案例已经很多了 但是作为菜鸟的我还是搞了半天哈 官网上面也有.但是一些细节方面的并没有说明.导致踩了半天坑才搞好 本案例的系统环境 wi ...
- (转)AIX7.1安装Nginx 1.13的方法
原文:https://blog.csdn.net/lvshaorong/article/details/79401860 https://blog.csdn.net/lvshaorong/articl ...
- Liunx之nginx配置
一.nginx安装 卸载yum安装的ngjnx yum remove nginx -y 编译安装nginx步骤 编译安装nginx的步骤 1.解决软件依赖 yum install gcc patch ...
- centos直接yum安装nginx
Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便. 但是今天装了CentOS6.2,直接yum install nginx不行,要先处理下源,下面是安装完整流 ...
- 安装Nginx服务
Nginx最大特点: 静态小文件(1M),支持高并发,同时占用系统资源很少.3W并发,10个进程,内存150M. Nginx特点: 1.配置简单,灵活,轻量. 2.高并发(静态小文件),静态几万的并发 ...
- Linux下安装nginx
一直会使用nginx,也学习了好多nginx知识.也在本地安装过nginx,这次是第一次在正式的环境安装nginx,把这些记录下来总结经验. 一.安装环境 操作系统:CentOS release 6. ...
- centos系统编译安装nginx+php环境另加独立mysql教程
以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...
随机推荐
- 3、原生jdbc链接数据库之锁与事务
一.锁的概念1.作用:是保证数据的一致性,只能一个人修改数据,不能同时多用户修改2.分类:行级锁和表级锁 乐观锁和悲观锁 二.事务1.为了保证数据的一致性和完整性,让数据库的多项操作合并为一个整体 ...
- jenkins使用5----gi服务器搭建连接
♦安装git ♦服务器创建git用户 [root@localhost home]# id git id: git:无此用户 [root@localhost home]# useradd git [ro ...
- centos7 搭建openvpn服务器
OpenVPN是一个开源代码的VPN应用程序,可让您在公共互联网上安全地创建和加入专用网络.相比pptp,openvpn更稳定.安全. 本篇博客主要介绍下面两点: 1. Centos 7下安装与配置O ...
- 摒弃FORM表单上传图片,异步批量上传照片
之前作图像处理一直在用form表单做图片数据传输, 个人感觉low到爆炸而且用户体验极差,现在介绍一个一部批量上传图片的小技巧,忘帮助他人的同时也警醒自己在代码的编写时不要只顾着方便,也要考虑代码的健 ...
- IDEA+控制台使用搜索\查找功能
- Linux VNC安装
cat /etc/centos-release CentOS Linux release 7.4.1708 (Core) uname -r 3.10.0-693.el7.x86_64 VNC下载:ht ...
- js 原生ajax实现
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- 从零开始搭建django前后端分离项目 系列二(项目搭建)
在开始项目之前,假设你已了解以下知识:webpack配置.vue.js.django.这里不会教你webpack的基本配置.热更新是什么,也不会告诉你如何开始一个django项目,有需求的请百度,相关 ...
- Python学到什么程度才可以去找工作?掌握这4点足够了!
大家在学习Python的时候,有人会问"Python要学到什么程度才能出去找工作",对于在Python培训机构学习Python的同学来说这都不是问题,因为按照Python课程大纲来 ...
- 【原创】自己动手写一个能操作redis的客户端
引言 redis大家在项目中经常会使用到.官网也提供了多语言的客户端供大家操作redis,如下图所示 但是,大家有思考过,这些语言操作redis背后的原理么?其实,某些大神会说 只要按照redis的协 ...