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的 ...
随机推荐
- C++ 之 简单的五子棋AI程序
本人是大一新生,寒假无聊,抱着试试看的心态(没有想到可以完成),写了C++的简单五子棋程序,开心. 下面是效果图: 一.首先讲讲大致思路. 五子棋实现的基础: ...
- Java中Map和Object的互相转换方式
一.使用Apache中的BeanUtils类,导入commons-beanutils包. Jar包Maven下载地址:https://mvnrepository.com/artifact/common ...
- Spring之旅第六篇-事务管理
一.什么是事务 什么是事务(Transaction)?事务是数据库中的概念,是指访问并可能更新数据库中各种数据项的一个程序执行单元(unit). 有个非常经典的转账问题:A向B转款1000元,A转出成 ...
- tcc-transaction 分析
tcc-transaction是TCC型事务java实现,具体项目地址 点我.本文通过tcc-transaction和Springcloud,分析下tcc-transaction的原理. 要了解一个 ...
- VIM新手福利,配置向
今天搜索VIM配置的时候,搜到一个神器 https://github.com/amix/vimrc The Ultimate vimrc Over the last 10 years, I have ...
- 高可用实现KeepAlived原理简介
一.简介 目前主流实现web网站及数据库服务高可用软件包括:keepalived.heartbeat.corosync,cman;高可用简称HA: 官方站点:https://www.keepalive ...
- 服务器linux centos 7.4 搭建ftp服务器
此操作是在腾讯云服务器linux centos 7.4 完成搭建ftp服务器 vsftpd 的: 安装 vsftpd $ yum install vsftpd -y 启动 $ service vsft ...
- DS标签控件文本解析格式
DS标签控件使用DSL文本渲染引擎,支持DSL引擎代码.目前支持代码如下: <b>粗体</b> 以粗体显示 <i>斜体</i> 以斜体显示 <u& ...
- tablednd onDrap 方法不调用
场景 使用 tablednd 插件时,onDrap 方法不调用 解决 给tr标签加 id 属性
- 学习笔记—XML
XML XML简介 XML指可扩展标记语言(EXtensible Markup Language),是一种标记语言. XML是一种灵活的语言,标签没有被预定义,需要自行定义标签. 通常,XML被用于信 ...