Centos7安装配置Nginx
Nginx 安装
系统平台:CentOS 7.4 64位。
一,安装编译工具及文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
二,安装PCRE
可以使Nginx支持Rewrite功能
1.安装
[root@localhost ] # cd /usr/local/src/
[root@localhost src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2,解压安装包
@localhost src]# tar zxvf pcre-8.35.tar.gz
3,进入安装目录
[root@localhost src]# cd pcre-8.35
4,编译安装
[root@localhost pcre-8.35]# ./configure
[root@localhost pcre-8.35]# make && make install
5,查看pcre版本
[root@localhost pcre-8.35]# pcre-config --version
三,安装Nginx
1,安装
wget http://nginx.org/download/nginx-1.15.5.tar.gz -P /usr/src
2,解压
[root@localhost src]# tar xf nginx-1.15..tar.gz
3,编译安装到指定目录
[root@localhost src]# cd nginx-1.15.
[root@localhost nginx-1.15.]# ./configure --prefix=/usr/local/src/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@localhost nginx-1.15.]# make
[root@localhost nginx-1.15.]# make install
4,查看版本
[root@localhost nginx-1.15.]# /usr/local/src/nginx/sbin/nginx -v

安装完成
5,检查配置文件
[root@localhost nginx-1.15.]# /usr/local/src/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/src/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/src/nginx/conf/nginx.conf test is successful
四,启动Nginx
[root@localhost nginx-1.15.]# /usr/local/src/nginx/sbin/nginx

五,Nginx常用命令
/nginx/sbin/nginx -s reload # 重新载入配置文件
/nginx/sbin/nginx -s reopen # 重启 Nginx
/nginx/sbin/nginx -s stop # 停止 Nginx
六,Nginx配置文件
worker_processes ; #设置值和CPU核心数一致
error_log /usr/local/webserver/nginx/logs/nginx_error.log crit; #日志位置和日志级别
pid /usr/local/webserver/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile ;
events
{
use epoll;
worker_connections ;
}
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'; #charset gb2312; server_names_hash_bucket_size ;
client_header_buffer_size 32k;
large_client_header_buffers 32k;
client_max_body_size 8m; sendfile on;
tcp_nopush on;
keepalive_timeout ;
tcp_nodelay on;
fastcgi_connect_timeout ;
fastcgi_send_timeout ;
fastcgi_read_timeout ;
fastcgi_buffer_size 64k;
fastcgi_buffers 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 16k;
gzip_http_version 1.0;
gzip_comp_level ;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on; #limit_zone crawler $binary_remote_addr 10m;
#下面是server虚拟主机的配置
server
{
listen ;#监听端口
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:;
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;
} }
Centos7安装配置Nginx的更多相关文章
- virtualBox安装centos7并配置nginx php mysql运行环境
virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...
- Centos7安装配置gitlab
Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...
- ELK 6安装配置 nginx日志收集 kabana汉化
#ELK 6安装配置 nginx日志收集 kabana汉化 #环境 centos 7.4 ,ELK 6 ,单节点 #服务端 Logstash 收集,过滤 Elasticsearch 存储,索引日志 K ...
- (转)windows 下安装配置 Nginx 详解
windows 下安装配置 Nginx 详解 本文转自https://blog.csdn.net/kingscoming/article/details/79042874 nginx功能之一可以启动一 ...
- Centos7安装配置Apache+PHP+Mysql+phpmyadmin
转载自: Centos7安装配置Apache+PHP+Mysql+phpmyadmin 一.安装Apache yum install httpd 安装成功后,Apache操作命令: systemctl ...
- Centos7安装配置JDK8
Centos7安装配置JDK8 一.准备工作 第一步,去甲骨文官网下载Jdk相应的版本,我这里下载的是jdk1.8. 第二步将你从官网上下载下来的jdk使用FTP工具上传到云服务器上的相应目录,我的是 ...
- centos7命令行和图形界面的相互切换(附centos7安装配置教程)
一.最近安装了centos7,发现在命令行和图形界面的相互切换命令上,与centos以往版本有很大不同,先整理如下,加深记忆. 1,centos7默认安装后,跟其他版本一样,启动默认进入图形界面: 2 ...
- (转)Centos7安装配置NFS服务和挂载
Centos7安装配置NFS服务和挂载 原文:https://www.u22e.com/601.html NFS简介 NFS(Network File System)即网络文件系统,是FreeBSD支 ...
- CentOS7 安装配置笔记
CentOS7 安装配置笔记 1.通过镜像安装 CentOS7 ==============================* 使用 UltraISO 9.7 或者 rufus-3.5p 制作ISO的 ...
随机推荐
- select下拉框的探索(<option></option>标签中能嵌套使用其它标签吗)
select标签大家应该经常用到,有个问题可能没怎么注意过, select标签里面的option标签可以嵌套其它标签吗,比如i,span标签等? 经本人测试,答案是:可以嵌套其它标签,但审查元素会 ...
- C# ListView 控件和 INotifyPropertyChanged 接口
ListView 控件和 DataGridView 控件 ListView 是跟 Winform 中 DataGridView 用法以及显示效果差不多的一个 WPF 控件,可以通过列表的方式方便的显示 ...
- Python300篇电子书免费送
此电子书集合由猪哥整理,免费发布于微信公众号:裸睡的猪. 此电子书集合将持续更新,获取最新电子书集合请关注微信公众号:裸睡的猪,回复:电子书此电子书集合仅用作个人学习,请勿用于商业获利!!! 获取方式 ...
- ASP.NET Core中使用GraphQL - 第七章 Mutation
ASP.NET Core中使用GraphQL - 目录 ASP.NET Core中使用GraphQL - 第一章 Hello World ASP.NET Core中使用GraphQL - 第二章 中间 ...
- SpringBoot + Spring Security 学习笔记(一)自定义基本使用及个性化登录配置
官方文档参考,5.1.2 中文参考文档,4.1 中文参考文档,4.1 官方文档中文翻译与源码解读 SpringSecurity 核心功能: 认证(你是谁) 授权(你能干什么) 攻击防护(防止伪造身份) ...
- 【网摘】C#.NET 在 MVC 中动态绑定下拉菜单的方法
1. 已知下拉菜单列表项: 在 Controller 控制器类中输入已下代码 1 public class DemoController : Controller 2 { 3 public ...
- c#编写一个简单的http服务器
先来张我的帅照哈哈哈 好了不臭美了 上代码 世间万物 只有想不到 没有做不到 哈哈哈 仔细阅读代码 我要凑够 150个字 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 ...
- PyQtdeploy-V2.4 User Guide 中文 (一)
PyQtdeploy 用户指南 目录 介绍 与V1.0+的差异 作者 证书 安装 部署过程概览 PyQt的演示 构建演示 Android IOS Linux MacOS Windos 构建系统根目录 ...
- MySQL字段操作与数据处理
一,对字段的操作 1.拼接字段:Concat()函数 多数DBMS使用 + 或者 || 来实现拼接,而MySQL使用 Concat() 函数来实现拼接. 实例: Concat()函数拼接时加上的字符需 ...
- Nginx Windows详细安装部署教程
一.Nginx简介 Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Ramble ...