nginx 配置两个域名
1、首先第一步安装:
参考:https://www.cnblogs.com/wyd168/p/6636529.html
启动:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
重启:[root@bhyw1 sbin]# ./nginx -s reload
关闭:
ps -ef|grep nginx
找到带master 行的进程 kill -QUIT 123333; 2、两个域名配置:
#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; upstream lpwyx{
server localhost:8089;
} upstream waibohou{
server localhost:9080;
}
#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 logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server { listen 80 default_server; server_name www.lpwyx.com;
location / { proxy_pass http://lpwyx;
}
#charset koi8-r; #access_log logs/host.access.log main; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} server {
listen 80; server_name www.waibohou.com;
location / { proxy_pass http://waibohou;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443;
# server_name localhost; # ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
SSL 配置不能用了就! 错误解决:[error] open() "/usr/local/nginx/logs/nginx.pid" failed
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动ssl看这个:https://www.cnblogs.com/piscesLoveCc/p/6120875.html;
nginx 配置两个域名的更多相关文章
- Nginx配置基于多域名、端口、IP的虚拟主机
原文:https://www.cnblogs.com/ssgeek/p/9220922.html ------------------------------- Nginx配置基于多域名.端口.IP的 ...
- Nginx 怎么给一台服务器,配置两个域名?详细的解说+截图教程
一. 环境.条件准备 一台云服务器(我的是腾讯的centos7) 至少两个域名.(我的是simuhunluo.xyz和simuhunluo.top.这两个域名之间没有任何关系,我是在阿里 ...
- 阿里云Linux系统Nginx配置多个域名的方法
Nginx绑定多个域名,可通过把多个域名规则写一个配置文件里实现,也可通过分别建立多个域名配置文件实现,为了管理方便,建议每个域名建一个文件,有些同类域名则可写在一个总的配置文件里. 1. 比如我想建 ...
- 一台服务器通过nginx配置多个域名(80端口)
1. 问题描述 多个域名对应一个服务器,为了避免域名后增加端口号,两个域名都需要占用80端口号,使用nginx来进行配置. 2. 解决方案 目前项目中,线上正在使用(100%可用)多域名对应一个服务器 ...
- 服务器 nginx配置 防止其他域名绑定自己的服务器
基于我的网站被其他的域名恶意绑定了,我做出了如下处理,全站转https,同时配置nginx跳转禁止其他绑定ip的域名访问(原理主机空域名可绑定任意的,参考https://www.jb51.net/ar ...
- Docker Nginx 配置多个子域名
参考:nginx server_name实用:配置多个子域名 在腾讯购置了域名服务,想直接配置二级域名映射到指定端口,发现腾讯不支持端口映射的方式. 想了一下,域名默认解析80端口,只能通过nginx ...
- nginx配置允许指定域名下所有二级域名跨域请求
核心原理是根据请求域名匹配是否是某域名的二级域名判断是否添加允许跨越头. #畅游www server { listen 8015; server_name test-tl.changyou.com; ...
- Nginx配置特定二级域名
首先把先在域名设置页面把二级域名解析到服务器的公网IP上,这里假设是 bbs.domainname.com 然后编辑 /etc/nginx/sites-available/domain.com.con ...
- Nginx配置之基于域名的虚拟主机
1.配置好DNS解析 大家好,今天我给大家讲解下在Linux系统下DNS服务器的基本架设,正向解析,反向解析,负载均衡,还有从域以及一个服务器两个域或者多个域的情况. 实验环境介绍:1.RHEL5.1 ...
随机推荐
- vuex2.0 基本使用(3) --- getter
有的组件中获取到 store 中的state, 需要对进行加工才能使用,computed 属性中就需要写操作函数,如果有多个组件中都需要进行这个操作,那么在各个组件中都写相同的函数,那就非常麻烦,这 ...
- codeforces263B
Squares CodeForces - 263B Vasya has found a piece of paper with a coordinate system written on it. T ...
- python第三方库的四种安装方法
1,直接pip install安装 2,在python-->default setting-->project interprer-->add 3,在这个链接里找到需要的包,下载 h ...
- 修改iptables后重启返回错误
在防火墙添加规则后我是这样改的vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ...
- [代码]--给任意网站添加聊天功能,随时聊(fa)天(che)
感谢“topurl.cn”制作此功能并分享. 这是一段代码,在打开的网页中使用,可以加载一个外挂形式的聊天室功能, 就可以和同样访问此网站进行相同操作的网友进行聊(fa)天(che)了. 使用方法: ...
- 利用kali破解wifi密码
准备工具 1.笔记本 2.USB无线上网卡(必备) 3.kali系统 4.密码字典 第一种方法 暴力破解法 何为暴力破解呢,其实就是一个一个密码去试,直到正确的密码. 现在的wifi一般加密都是: 1 ...
- Sublime Text ——3200破解补丁
声明 该资源来源于网络,只为学习交流使用,侵权联系删除.长期使用和觉得sublime text 不错的话,还望购买授权码,多多支持正版!!! 重要的事情说三遍 请支持正版!!! 请支持正版!!! 请支 ...
- .net MVC 访问404
MVC 项目访问总是404 有几种情况: 1 地址打错了. 2 controller/action 但是action方法含有[ActionName("Index")] 重命名了. ...
- 云服务器搭建在线ssh终端GateOne
由于公司在使用内网和安全桌面,不能在安全桌面中安装Xshell的ssh终端,所有想操作个人公网服务器很困难. 查阅发现,使用GateOne可以在服务器上搭建一个在线的ssh工具.使用体验友好,可以满足 ...
- python主流测试框架的简介
1.python自动化的一些测试框架 1).unitest(也称为PyUnit) 地址:https://docs.python.org/2/library/unittest.html 2).Nose ...