-
[武汉|结业弟子]JS-严泽浩1
先贴上我的配置吧
nginx配置
# 任务6-10萝卜多后台server {listen 66;server_name www.js6.com;#charset koi8-r;#access_log logs/host.access.log main;location / {root D://dc//webstudy//js//ajax06;index index.html;}#location拦截名为:carrots-admin-ajax,用于拦截请求,匹配任何以carrots-admin-ajax开头的地址,#匹配符合以后,停止往下搜索正则。location /carrots-admin-ajax/ {#代理转发proxy_pass http://dev.admin.carrots.ptteng.com/;}#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;}}hosts文件配置
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 www.js6.com
接下来开始简要介绍一下,更具体的内容在网上都可以很方便的搜索到
1. 不是每次换一次任务都需要重新配置一次nginx,而是在原有配置文件的基础上新增对应的配置,比如说任务6-10和复盘是可以在一个nginx配置文件中共存的
2. 端口这方面可以随意,但要知道一点,浏览网页服务默认的端口号都是80,因此只需输入网址即可,不用输入“:80”了
3. hosts配置操作起来非常简单,如上所述,本质上就是指定IP和域名的映射关系,这里着重要理解协议,端口,域名,DNS服务器,同源策略等基本概念,搜索这些关键词都可以找到很详细的资料,总之抱着一个疑问:当我们浏览一个网页时,背后都发生了什么,都是些流程,记住就好
编辑于2018-09-21
- 去第 页