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;

转载于:https://www.cnblogs.com/hoge66/p/10360458.html

nginx 配置两个域名相关推荐

  1. 1 阿里云Nginx配置https实现域名访问项目

    第一步:签署第三方可信任的 SSL 证书 证书可以直接在阿里云里面申请免费的ssl证书 登录阿里云账号,在上方搜索栏内搜索ssl,点击ssl证书(应用安全) 来到这个页面后点击购买证书 如图选择免费版 ...

  2. Windows环境下Nginx配置本地虚拟域名和Nginx代理

    Windows环境下Nginx配置本地虚拟域名和Nginx代理 一.准备 (1) 进入 Nginx 安装目录,如:E:\GreenSofts\Nginx-1.21.4 (2) 检查当前目录下是否存在 ...

  3. nginx配置动态ssl域名转发

    nginx配置动态ssl域名转发 应用场景 具体需求描述 网关配置 遇到的问题 应用场景 作为第三方站点服务供应商,我们需要每天对接大量的第三方域名及其ssl证书,如果我们为每个客户的域名配置一个se ...

  4. Nginx 怎么给一台服务器,配置两个域名?详细的解说+截图教程

    一.        环境.条件准备 一台云服务器(我的是腾讯的centos7) 至少两个域名.(我的是simuhunluo.xyz和simuhunluo.top.这两个域名之间没有任何关系,我是在阿里 ...

  5. nginx 配置多个域名 指向不同服务_Nginx的几个常用配置和技巧

    文章列举了几个Nginx常见的,实用的,有趣的配置,希望看过之后能说一句:学到了! 一个站点配置多个域名 server { listen 80; server_name ops-coffee.cn b ...

  6. 微信支付:nginx配置 网页授权域名 用户在网页授权页同意授权给公众号后,微信会将授权数据传给一个回调页面,回调页面需在此域名下,以确保安全可靠。

    nginx配置图

  7. nginx配置本地地址映射域名以及域名转发指定ip

    首先安装nginx,参加博客:https://www.cnblogs.com/qfb620/p/5508468.html 按照博客写的访问127.0.0.1查看是否访问成功,成功即安装成功. 下一步就 ...

  8. Apache 配置两个域名匹配的文件夹和配置多个Web站点

    Apache的虚拟主机是一种同意在同一台机器上,执行超过一个站点的解决方式,同一时候也就能够邦迪二级域名到指定的文件夹.虚拟主机有两种.一种叫基于IP的(IP-based),还有一种叫基于名字的(na ...

  9. Nginx配置 多个域名指向同一个服务器文件

    这里写自定义目录标题 目的 准备工作 修改内容 注意: 目的 因为公司开发方面有响应的需求,需要多个域名指向同一个服务器下的文件(即访问的域名不同但访问的服务器下的文件是同一个) 准备工作 已经过解析 ...

最新文章

  1. aes key长度_原创 | 浅谈Shiro反序列化获取Key的几种方式
  2. linux启动时间极限优化,Linux启动时间的极限优化
  3. sicily 1259 Sum of Consecutive Primes
  4. html线框聚焦效果,24种表单input输入框聚焦动画特效
  5. linux里工作目录的字体变蓝,netterm访问Linux时字体和背景颜色随目录发生改变的问题解决...
  6. Python删除文件夹和建立文件夹
  7. Java Long类shortValue()方法与示例
  8. 工业相机硬汉!这款相机被NASA选择,全程记录毅力号登陆火星
  9. P01:01背包问题(转)
  10. C++ 获取URL图片、html文件,CInternetSession 【转】
  11. 如何简单形象又有趣地讲解神经网络是什么
  12. c语言的数据结构,c语言中数据结构是什么?常见数据结构有哪些?
  13. 计算机基础知识总结(一)
  14. nginx HTML网页乱码
  15. html5游戏毕业答辩ppt,毕业论文答辩ppt格式(超详细解释)
  16. 2021年100道最新软件测试面试题,常见面试题及答案汇总
  17. 压力换算公斤单位换算_压力单位换算方法
  18. 搜狗输入法不能正常使用?
  19. arcgis小班编号问题 工具箱来喽
  20. C语言中getch()的用法

热门文章

  1. 袁崇焕·任志强·张纪中
  2. OpenCV Sobel检测算子和Scharr检测算子
  3. GiliSoft Video Editor 13中文版
  4. formZ Pro 9(3D绘图软件)中文版
  5. 【全文搜索引擎】Elasticsearch基本查询基础JavaAPI
  6. 结果集耗尽时,检查是否关闭结果集时常用sql
  7. 注意android辅助服务事件不能用于保存
  8. STL源码分析-bitset
  9. 两个div叠加触发事件发生闪烁问题
  10. 单独部署activemq-web-console (转载)