CentOS7.3下yum练手安装Nginx
安装Nginx
# 查看相关信息
yum info nginx yum info httpd
# 移除 httpd,也就是 Apache
yum remove httpd -y
# 安装 nginx
yum install nginx -y
#设置 nginx 自启动
chkconfig nginx on
# 查看服务自启动情况
chkconfig
# 启动nginx服务
service nginx start
# 查看端口监听状态
netstat -ntl
# 此时你可以访问试试了
# 例如: http:/IP
# 如果访问不了,请 ping 一下试试
# 或者查看 firewalld 防火墙状态
启动: systemctl start firewalld
查看状态: systemctl status firewalld
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
centos7用的firewalld
firewalld默认已经安装并启用了,如果需要nginx可以访问需要执行以下命令:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --zone=trusted --add-port=/tcp
PS:如果你是用的阿里云
请到安全组里面添加一个规则 设置可访问80端口 要不然是怎么都不会OK的
配置Nginx反向代理
/etc/nginx/nginx.conf
user nginx;
worker_processes ; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events {
use epoll;
worker_connections ;
} http {
include /etc/nginx/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 /var/log/nginx/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; gzip on; # Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf; include upstream.conf;
include cncounter.com.conf; }
做负载的配置: /etc/nginx/upstream.conf
upstream www.cncounter.com {
server 127.0.0.1:;
}
站点配置文件: /etc/nginx/cncounter.com.conf
server
{
listen ;
server_name www.cncounter.com;
index index.jsp;
root /usr/local/cncounter_webapp/cncounter/;
location ~ ^/NginxStatus/ {
stub_status on;
access_log off;
} location / {
root /usr/local/cncounter_webapp/cncounter/;
proxy_redirect off ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout ;
proxy_send_timeout ;
proxy_read_timeout ;
proxy_buffer_size 256k;
proxy_buffers 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_pass http://www.cncounter.com;
}
}
重启服务
service nginx stop service nginx start
CentOS7.3下yum练手安装Nginx的更多相关文章
- CentOS7.3下yum练手安装Nginx,支持php5.4
yum install php php-devel 安装的是5.4 那么安装完毕了,怎么设置nginx和php 解析 1 添加nginx 默认主页index.php vim .../etc/ngin ...
- Centos7.3下mysql5.7.18安装并修改初始密码的方法
Centos7.3下mysql5.7.18安装并修改初始密码的方法 原文链接:http://www.jb51.net/article/116032.htm 作者:Javen205 字体:[增加 减小] ...
- 原创:centos7.1下 ZooKeeper 集群安装配置+Python实战范例
centos7.1下 ZooKeeper 集群安装配置+Python实战范例 下载:http://apache.fayea.com/zookeeper/zookeeper-3.4.9/zookeepe ...
- centos7.5下yum 安装mariadb数据库
前言 mariadb 和mysql就像亲兄弟的关系,各种语法.驱动啥的,在mysql上能上的,在mariadb上基本都可以直接使用.更多的细节在此不多说. 1.删除旧版本 centos7下默认安装有m ...
- CentOS7 linux下yum安装mysql5.7
文章参考(https://www.cnblogs.com/jorzy/p/8455519.html) 1.创建存放安装包的位置,并且进入该目录 命令mkdir /share 命令cd /share 2 ...
- CentOS7.3下yum安装MariaDB10.3.12并指定utf8字符集
添加MariaDB的yum源,指定安装的版本,然后使用 yum 工具进行安装 参考MariaDB官方网站对应安装方法和步骤 https://downloads.mariadb.org/mariadb/ ...
- centos7.7下docker与k8s安装(DevOps三)
1.系统配置 centos7.7 docker 1.13.1 centos7下安装docker:https://www.cnblogs.com/pu20065226/p/10536744.html 2 ...
- centos6.5 64练手安装memcached,PHP调试
思路 先安装 memcached 然后安装php的基于扩展libmemcache ,然后安装php memcache扩展包,然后把扩展添加到php.ini 1 yum安装 简单方便 yum ins ...
- Linux系统 Centos7/Centos6.8 yum命令在线安装 MySQL5.6
Linux系统 Centos7 yum命令在线安装 MySQL5.6 标签: centosmysqlyum 2015-11-18 17:21 707人阅读 评论(0) 收藏 举报 分类: Linux ...
随机推荐
- 抓老鼠 codeForce 148D - Bag of mice 概率DP
设dp[i][j]为有白老鼠i只,黑老鼠j只时轮到公主取时,公主赢的概率. 那么当i = 0 时,为0 当j = 0时,为1 公主可直接取出白老鼠一只赢的概率为i/(i+j) 公主取出了黑老鼠,龙必然 ...
- ppt罗列项排版
关于罗列项的排版(1,....2,......3,......4,........)
- Android和Linux下设备节点的创建笔记
1. Linux kernel创建的/dev/下的设备节点是不对的, 其实是kernel仅负责在/sys/(基于内存的虚拟文件系统)创建一大堆下目录和文件,而真正的设备节点是在用户空间程序创建的,应该 ...
- 使用just-api 进行接口测试
just-api 是基于配置的测试,同时支持基于jsonpath jsonschema 的数据校验, 对于数据的请求只集成hook,支持测试失败重试.测试报告.graphql api 测试.... 使 ...
- 浏览器的自动翻译会影响 JS 逻辑
有人在 QQ 群里反馈,官方注册后跳转时出现 Bug. 收到群友非常有用的资讯,这是因为浏览器的自动翻译功能引起的. 11:04:21[潜水]Better Command 2017/12/30 11: ...
- python Django Nginx+ uWSGI 安装配置
环境: CentOS7.python-3.5.3.Nignx 1.10.3 .Django 1.10.6.uWSGI 2.0.14 django项目目录:/var/webRoot/p1 项目结构: 基 ...
- asp.net core控制台项目运行
cmd中进入项目生成的dll目录下 运行命令: start dotnet xxx.dll
- dkh人力资源大数据解决方案整体架构
大数据技术的应用正在潜移默化改变着我们的日常生活习惯和工作方式,很多看起来有点“不可思议”的事情也渐渐被我们“习以为常”.大数据可能在国内的起步较晚,但我们可能却是对大数据应用最好的了代表了.前些时候 ...
- Qt常用类及类方法简介之 QAction类
1.QAction::QAction ( const QString & text, QObject * parent ) QAction类的构造函数之一,利用text,parent创建 ...
- 安装Linux软件时没有图形界面的问题
Q: 现在Linux下的软件有很多也采用图形界面安装了:但有时候我们发现启动安装程序时本该出现图形界面时却出现了文本界面. A: 检查常用的图形函数库(最主要的自然是gtk, qt)是否已安装.尤其是 ...