In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to use Nginx to configure the CDN server under Linux. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Because it is convenient to use docker to configure Nginx, bloggers use docker as a container to configure
The first step, Configure the docker-compose.yml file version:'3 services: nginx: restart: always image: nginx container_name: nginx-1 ports:-80:80 volumes:-/ usr/local/application/nginx/conf/nginx.conf:/etc/nginx/nginx.conf-/ usr/local/application/nginx/logs/:/var/log/nginx/ -/ usr/local/application/nginx/data/:/var/share/nginx/html/-/ usr/local/application/nginx/cdn/:/usr/share/nginx/html/
Explain several important parts of the above code
First of all, there is the value of the node volumes: the mapping of the first configuration file of is followed by the host, followed by the second log mapping of the container , the third data file mapping , the mapping of the fourth cdn of , the second step of configuring the nginx.conf file.
nginx.fonf
User nginx;worker_processes 1; events {worker_connections 1024;} http {include mime.types; default_type application/octet-stream; keepalive_timeout 65; server {listen 80; server_name 192.168.157.128; location / {root / usr/share/nginx/html; index index.html index.htm Add_header 'Access-Control-Allow-Origin'' *'; add_header 'Access-Control-Allow-Credentials'' true'; add_header 'Access-Control-Allow-Methods'' GET, PUT, POST, DELETE, OPTIONS';} location ~ *. (eot | ttf | woff | woff2 | svg | otf) ${add_header Access-Control-Allow-Origin *; root / usr/share/nginx/html }}}
Explain the meaning of the above code
The first place: the value of root represents the value in the container because it is mapped to the conf file of the container. The second place: three add_header , the first represents the domain allowed to be accessed, * indicates unified configuration, for security, the custom domain name is recommended, the second indicates whether to take Cookie , and the third indicates the allowed request method, GET and OPTIONS must vote for a third party: the values of include and default_type indicate the content of the requested Content-Type, if not set. Css files and js files that use CDN in html will report an error in the browser and do not understand the COntent-Type type. The above is the editor for you to share how to use Nginx to do the configuration under the CDN server under Linux. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.