server {
listen 80;
server_name www.abc.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8888;
}
}
分析问题
以前也没有用过 Apache
,只是知道曾经的 httpd
作为 HTTP
服务器风靡一时,下面就找下这该死的 Hello Apache!
究竟从何而来。。
第一反应,难道有个Apache在运行?
root@iZuf69c5h89bkzv0aqfm8lZ:~# apache -v
-bash: apache: command not found
检查了下Nginx的默认页面,没毛病
root@iZuf69c5h89bkzv0aqfm8lZ:~# cat /usr/share/nginx/html/index.html
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
Commercial support is available at
Thank you for using nginx.
继续查找httpd或者apache,到这里仍一无所获
root@iZuf69c5h89bkzv0aqfm8lZ:~# which httpd
root@iZuf69c5h89bkzv0aqfm8lZ:~# whereis httpd
httpd:
继续查找httpd或者apache,此时发现有个与apache相关的已安装的软件包,哦~ 原来是apache2
root@iZuf69c5h89bkzv0aqfm8lZ:~# dpkg -l | grep httpd
root@iZuf69c5h89bkzv0aqfm8lZ:~# dpkg -l | grep apache
ii apache2 2.4.18-2ubuntu3.5 amd64 Apache HTTP Server
ii apache2-bin 2.4.18-2ubuntu3.5 amd64 Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.18-2ubuntu3.5 all Apache HTTP Server (common files)
ii apache2-utils 2.4.18-2ubuntu3.5 amd64 Apache HTTP Server (utility programs for web servers)
随手在网上查了下,原来httpd改名为apache2了
root@iZuf69c5h89bkzv0aqfm8lZ:~# which apache2
/usr/sbin/apache2
查看apache2版本信息,这台主机也比较久远了,应该是随着Ubuntu系统安装的
root@iZuf69c5h89bkzv0aqfm8lZ:~# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-09-18T15:09:02
而且,apache2还是开机自启的
root@iZuf69c5h89bkzv0aqfm8lZ:~# systemctl is-enabled apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install is-enabled apache2
enabled
经过了解,apache2有个管理工具apachectl,找下它的位置
root@iZuf69c5h89bkzv0aqfm8lZ:~# which apachectl
/usr/sbin/apachectl
查看这个文件的内容,可找到关于HTTPD的启动文件路径的一行配置
root@iZuf69c5h89bkzv0aqfm8lZ:~# less /usr/sbin/apachectl
the path to your httpd binary, including options if necessary
HTTPD=${APACHE_HTTPD:-/usr/sbin/apache2}
那么,返回的‘Hello Apache!’到底是从哪里来的?在目录/var/www/html下有个index.html
root@iZuf69c5h89bkzv0aqfm8lZ:~# cat /var/www/html/index.html
Hello Apache!
解决方法
可在 Nginx
中的 server_name
处同时配置多个域名:
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!**
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!