nginx

nginx网站服务如何配置防盗链

橙三吉。 提交于 2021-01-20 20:50:27
nginx如何配置防盗链 一、盗链原理 1.1 网页准备 1.2 浏览器访问验证 二、配置防盗链 2.1 修改配置文件 2.2 浏览器访问验证 一、盗链原理 1.1 网页准备 Web源主机(192.168.153.20)配置 cd /usr/local/nginx/html 将preview.jpg图片文件传到/usr/local/nginx/html目录下 vim index.html ...... <img src="preview.jpg"/> </body> </html> echo "192.168.153.20 www.wt.com" >> /etc/hosts echo "192.168.153.10 www.abc.com" >> /etc/hosts 盗链网站主机(192.168.153.20)配置 为了区别于源主机的 nginx 服务,盗链主机使用一般的wed服务即可 yum install -y httpd vim /var/www/html/index.html <html><body><h1>Hello!</h1> <img src="http://www.wt.com/preview.jpg"/> </body></html> echo "192.168.153.20 www.wt.com" >> /etc/hosts echo "192.168.153

Django/Nginx - Error 403 Forbidden when serving media files over some size

有些话、适合烂在心里 提交于 2021-01-20 18:14:43
问题 When user uploads image, it is stored in media folder inside project directory. The problem is that when they want to see it on the website, nginx return 403 Forbidden error for images over approximately 3 Mb. I set nginx.conf client_max_body_size to 8M http { ## # Basic Settings ## client_max_body_size 8M; ... And already changed memory size in settings.py : FILE_UPLOAD_MAX_MEMORY_SIZE = 8388608 When I upload an image under 3 MB, there are no problems, if I upload image over 3 MB, I can see

proxy_pass does not resolve DNS using /etc/hosts

本秂侑毒 提交于 2021-01-20 18:00:12
问题 In nginx the proxy_pass directive is not resolving DNS using the /etc/hosts file. Any way to enable this possibility (maybe by leveraging Lua as a last resort)? 回答1: In short, you need to install dnsmasq locally and use 127.0.0.1 as a resolver. See this related question and answer: When using proxy_pass, can /etc/hosts be used to resolve domain names instead of "resolver"? 回答2: If you have a server with systemd you can use the nameserver shipped with it, systemd-resolved, to resolve your

proxy_pass does not resolve DNS using /etc/hosts

血红的双手。 提交于 2021-01-20 17:59:45
问题 In nginx the proxy_pass directive is not resolving DNS using the /etc/hosts file. Any way to enable this possibility (maybe by leveraging Lua as a last resort)? 回答1: In short, you need to install dnsmasq locally and use 127.0.0.1 as a resolver. See this related question and answer: When using proxy_pass, can /etc/hosts be used to resolve domain names instead of "resolver"? 回答2: If you have a server with systemd you can use the nameserver shipped with it, systemd-resolved, to resolve your

Can i deploy my .war on an nginx server

让人想犯罪 __ 提交于 2021-01-20 16:29:20
问题 I really love nginx for the stability and way requests are handled. And i really love tomcat for the java and the user friendliness Is there a way to deploy my .war on a nginx server ? 回答1: I don't believe this is possible as nginx is not a servlet container, so it has no understanding of what a .war file is. You can configure nginx to act as a reverse proxy in front of a Tomcat server so this might get you the best of both worlds. A quick Google search came up with this http://wiki.nginx.org

Can i deploy my .war on an nginx server

不问归期 提交于 2021-01-20 16:27:59
问题 I really love nginx for the stability and way requests are handled. And i really love tomcat for the java and the user friendliness Is there a way to deploy my .war on a nginx server ? 回答1: I don't believe this is possible as nginx is not a servlet container, so it has no understanding of what a .war file is. You can configure nginx to act as a reverse proxy in front of a Tomcat server so this might get you the best of both worlds. A quick Google search came up with this http://wiki.nginx.org

【前端词典】进阶必备的网络基础

爷,独闯天下 提交于 2021-01-20 14:37:15
前言 在不那么遥远的一些年以前,一个在江湖中行走的前端,只需要了解“前端三剑客”就足以找到一份工作。很多前端只限于 CSS , HTML 、 JS ,网络基础,数据结构之类的都不甚了解。不过这个时期的前端也是最受鄙视的时期,这个时期前端的大量工作依赖于后端,且不需要动画效果和交互效果。 现如今前端圈已经发生翻天覆地的变化, Vue , React , ES6 , HTML5 , CSS3 , Webpack , PostCss 等技术层出不穷。作为一个有格局的前端,对网络基础定是要了然于心的。 如果你对网络基础还不太了解,以下的内容可以给你提供一个思路;如果你对此已经了然于心,以下的内容烦请批评指正。 入题 任何事物的诞生,最初都是服务于极少数人的。渐渐地被这极少数人推而广之,我们大众就开始接触了解它,互联网是如此,麻将亦是如此。不管是互联网还是麻将,它们都增强了人与人之间的交流。 接下来我会讲以下内容: 五层因特网协议栈 HTTP 与 HTTPS 的区别 TCP/IP 协议 三次握手和四次挥手 DNS 域名解析 五类 IP 地址 跨域的原因及处理方式 正向代理和反向代理 CDN 带来的性能优化 HTTP 强缓存&协商缓存 五层因特网协议栈 TOP 五层因特网协议栈这个知识点对你来说或许有点枯燥,不过当你对这个协议栈有了一个初步的了解之后,你之前的某些疑问就会很明朗。 一、应用层

docker学习——03、容器数据卷、DockerFile、Docker网络

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-20 10:39:25
容器数据卷 什么是容器数据卷 docker的理念回顾 将应用和环境打包成一个镜像! 数据?如果数据都在容器中,那么我们容器删除,那么数据就会丢失! 需求:数据可以持久化 如MySQL,容器删了,就要跑路了! 需求:MySQL数据可以存储在本地! 容器之间可以有一个数据共享的技术! Docker容器中产生的数据,同步到本地! 这就是卷技术!其实就是目录的挂载,将我们容器内的目录挂载到Linux上面! 总结一句话:容器的持久化和同步操作!容器间也是可以数据共享的! 使用数据卷 方式一:直接使用命令来挂载 -v docker run -it -v 主机目录 : 容器内目录 # 测试 [root@dockertest ~] # docker run -it -v /home/ceshi:/home centos /bin/bash # 启动起来后我们可以通过 docker inspect 容器id 查看挂载信息 1 1 测试文件的同步 再来测试! 1、停止容器 2、宿主机上修改文件 3、启动容器 4、容器内的数据依旧是同步的! 好处:我们以后修改只需要在本地修改即可,容器内会自动同步! 实战:安装MySQL 思考:MySQL的数据持久化的问题! # 获取镜像 [root@dockertest network-scripts] # docker pull mysql:5.7 # 运行容器

Ansible 之 通过yum模块安装软件

拜拜、爱过 提交于 2021-01-20 10:23:23
一、安装Nginx #可通过ansible-doc yum 查看对应的帮助文档 [root@Ansible ~]# ansible test -m command -a "wget -O /etc/yum.repos.d/epel.repo" #下载epel源 [root@Ansible ~]# ansible test -m command -a "yum clean all" -u cedar -b [root@Ansible ~]# ansible test -m command -a "yum makecache" -u cedar -b [root@Ansible ~]# ansible test -m command -a "yum info nginx" -u cedar -b [root@Ansible ~]# ansible test -m yum -a "name=nginx state=present" -u cedar -b 10.3.153.8 | CHANGED => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": true, "changes": { "installed": [ "nginx" ] }, [root

502 Bad Gateway with DigitalOcean (gunicorn/nginx) using Selenium and Django

纵然是瞬间 提交于 2021-01-20 09:07:30
问题 I have a web-app with DigitalOcean (gunicorn/nginx) using Selenium and Django. I'm trying to scrap data from 3 websites and save this data in a database, but I get this error if the process take more than 60 seconds 502 Bad Gateway nginx/1.14.0 (Ubuntu) How can I extend or disable response waiting time for nginx ? 回答1: This error message... 502 Bad Gateway nginx/1.14.0 (Ubuntu) ...using DigitalOcean (gunicorn/nginx) can occur for a number of reasons. Determining the exact cause of 502 error