CentOS 7 安装Nginx并实现域名转发
CentOS 7 条件
教程中的步骤需要root用户权限。
一、添加Nginx到YUM源
添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
二、安装Nginx
在你的CentOS 7 服务器中使用yum命令从Nginx源服务器中获取来安装Nginx:
sudo yum install -y nginx
Nginx将完成安装在你的CentOS 7 服务器中。
三、启动Nginx
刚安装的Nginx不会自行启动。运行Nginx:
sudo systemctl start nginx.service
如果一切进展顺利的话,现在你可以通过你的域名或IP来访问你的Web页面来预览一下Nginx的默认页面;
打开/etc/nginx/文件夹下找到nginx.conf文件打开进行编辑
user nginx;
worker_processes ; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; events {
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 ; server
{
listen ;
server_name www.xxxx.com;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://xxxxx:8088;
} } #gzip on; include /etc/nginx/conf.d/*.conf;
}
主要是添加server块代码
CentOS 7 安装Nginx并实现域名转发的更多相关文章
- CentOS 7 安装 Nginx 配置反向代理
Linux使用Nginx Yum存储库上安装Nginx,适用于Red Hat Enterprise Linux和CentOS系统. 1.添加设置Nginx Yum存储库 在CentOS中首次安装Ngi ...
- 删:Centos 7安装Nginx 1.8
[CentOS 7] 安装nginx! 首先进行 nginx yum Nginx安装记录 注意:如果用源码安装,nginx配置时需要指定--with-pcer对应的压缩包路径,如果使用二进制安装不需要 ...
- linux/centos下安装nginx(rpm安装和源码安装)详细步骤
Centos下安装nginx rpm包 ...
- CentOS下安装Nginx并添加nginx_upload_module
安装前,最好能保证依赖的系统软件已经升级. yum update CentOS上安装Nginx,如果只是简单安装,不附加其他第三方模块,一句话可以搞定: yum install nginx ...
- CentOS 7安装nginx
CentOS 7安装nginx 参考网上其他文章做的 安装Nginx 我们从nginx官方的RPM源来安装一个预构建的稳定版本的nginx包. rpm --import http://nginx.or ...
- Nginx配置以及域名转发
工程中的nginx配置 #user nobody; worker_processes 24; error_log /home/xxx/opt/nginx/logs/error.log; pid /ho ...
- Centos 在线安装 nginx
centos 在线安装 nginx 安装nginx 参考文档: http://nginx.org/en/linux_packages.html 中的RHEL/CentOS章节,按照步骤安装repo ...
- CentOS 下 安装 nginx 执行配置命令 ./configure 报错
CentOS 下 安装 nginx 执行配置命令 ./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx 时提示以下错误: checkin ...
- 阿里云centos下安装nginx、jdk、tomcat、绑定域名、解析域名
1.ESC后安全设置(管理控制台->本实例安全组->配置规则->添加安全组规则->3306.80端口配置) 2.nginx 安装,首先安装三大件 PCRE.zlib.ope ...
随机推荐
- 【转】Dalvik虚拟机的启动过程分析
在Android系统中,应用程序进程都是由Zygote进程孵化出来的,而Zygote进程是由Init进程启动的.Zygote进程在启动时会创建一个Dalvik虚拟机实例,每当它孵化一个新的应用程序进程 ...
- pocsuite 实现一个verify检测功能
今天在测试中发现一个命令执行漏洞,尝试用创宇的pocsuite框架实现.说实话,这玩意儿确实没有自己写POC顺手,非得就着他的标准来,就很难受,以至于耽误了很多时间在规范上.. 影响参数后直接用||连 ...
- Idea Find in Path 全局搜索的功能
当我们想查找哪些文件中含有某个关键词时,就要依靠Find in Path,相当于一个全局搜索的功能.
- html上传图片(进度条变化)、音乐
<html> <head> <title>$Title$</title> </head> <link href="css/b ...
- 如何在Unity中显示FPS
using UnityEngine; using System.Collections; public class example : MonoBehaviour { public float upd ...
- 掘金上发现的有趣web api
本篇文章主要选取了几个有趣且有用的webapi进行介绍,分别介绍其用法.用处以及浏览器支持度 page lifecycle onlineState(网络状态) device orientation(陀 ...
- Long数组转String数组
public static String[] longToString(Long longArray[]) { if (longArray == null || longArray.length &l ...
- DB2表空间重定向恢复数据库实战
DB2的备份恢复有点坑,当源系统和目标系统的路径设置不同时,要手动进行重定向恢复,本文是我一次实战操作之后总结的过程,仅供参考. 一.发出重定向恢复命令 DB2 RESTORE DB TO " ...
- Spring框架中的IOC?
Spring中的org.springframework.beans包和org.SpringframeWork.context包构成了Spring框架IOC容器的基础.BeanFactory接口提供了一 ...
- 数据库查询服务DBCacheServer
各个业务系统,都需要查询各类数据库; 一般查询数据库都是客户端自己连接,根据现在的情况,存在以下几点问题 1.客户端连接很多,连接大小,峰值不可控 2.客户端SQL程序员自己写,参差不齐 3.SQL书 ...