docker nginx实现一个主机部署多个站点 *** 作

docker nginx实现一个主机部署多个站点 *** 作,第1张

dockernginx实现一个主机部署多个站点 *** 作

本文详细介绍了dockernginx在一台服务器上部署多个网站的实际 *** 作,具有非常好的实用价值,希望对大家有所帮助。跟我回去看看。

在某站租的vm虚拟机快到期了,续费200多元。想到阿里云服务器里新买的网络服务器还不如过去迁移这个。我也会用真实的域名。别黑我的网站就行。谢谢你。

阿里云已经在服务器中部署了一个网站,用网站域名www.dcssn.com就可以立即访问。我的想法是使用www.xhxf119.com青睐这个服务器,并根据不同的网站域名访问不同的服务。

优先

域名解析必须偏向此服务器的ip。

然后

为www.dcssn.com的服务项目开放端口号8080,dockerrun-p8080:80weianan

www.xhxf119.com服务项目开放端口号8081,dockerrun-p8081:80新华

Www.dcssn.com:8080可以正常访问www.xhxf119.com:8081,他可以正常访问。

接下来,编写nginx的环境变量

nginx.conf worker_processes1; events{ worker_connections1024; } http{ includemime.types; default_typeapplication/octet-stream; sendfileon; keepalive_timeout65; server { listen80; server_namewww.dcssn.com; location/{ proxy_redirectoff; proxy_set_headerHost$host; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; proxy_passhttp://47.92.69.112:8080; } } server { listen80; server_namewww.xhxf119.com; location/{ proxy_redirectoff; proxy_set_headerHost$host; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; proxy_passhttp://47.92.69.112:8081; } } }

然后将该文档保存到/host/path/file目录中。

dockerrun-namemy-custom-nginx-container-v/host/path/nginx.conf:/etc/nginx/nginx.conf:ro-d-p80:80nginx

大概就是这样。你可以立即输入www.dcssn.com或www.xhxf119.com访问。

填写专长:docker为几个不同二级域名的新项目文件目录配备了nginx

还是有机会拿到反向代理分销的。

实际的php和nginx配置可以在你自己的博客中找到。

cd/root/nginx/conf/conf.d

vimrunoob-test-php.conf

runoob-test-php.conf文档内容实际上是二级域名匹配的文件目录。

server{ listen80; server_namewww.liuyuanshan.top; location/{ #proxy_passhttp://106.52.36.65:80; root/usr/share/nginx/html; indexindex.phpindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ root/usr/share/nginx/html; } location~\.php${ fastcgi_passphp:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME/var/www/html/$fastcgi_script_name; includefastcgi_params; } } server{ listen80; server_namemessage.liuyuanshan.top; location/{ root/usr/share/nginx/html/message/; indexindex.phpindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ root/usr/share/nginx/html; } location~\.php${ fastcgi_passphp:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME/var/www/html/message/$fastcgi_script_name; includefastcgi_params; } } server{ listen80; server_namewordpress.liuyuanshan.top; location/{ root/usr/share/nginx/html/wordpress/; indexindex.phpindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ root/usr/share/nginx/html; } location~\.php${ fastcgi_passphp:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME/var/www/html/wordpress/$fastcgi_script_name; includefastcgi_params; } }

重启码头工人的nginx船

docker重启ngixn

以上dockernginx完成一个服务器,部署几个网站。实际 *** 作就是我跟大家分享的所有内容。期待给你一个参考,也期待你的申请。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/774150.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存