In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
A virtual host server {listen 80; server_name www.yang.com; # virtual machine host focuses on the same ip port. The virtual machine host relies on the domain name here to route the content of the root / yang/; # root directory index index.html index.php; access_log / yang/yang_com_access.log main Location / {}}
# the virtual machine host only needs to create another .conf file in the conf.d directory, and configure the server segment in it. If it is the same ip port, it is distinguished by the domain name, just like the code above
Second log
# these fields control the log output
$remote_addr variable: records the IP address of the client (normally). Remote_user variable: when nginx enables user authentication, this variable records which user the client uses for authentication. $time_local variable: records the time of the current log entry. Request variable: records the method, url, and http protocol version of the current http request. Status variable: records the response status of the current http request, that is, the response status code, such as 200,404, etc., is recorded in this variable. Body_bytes_sent variable: records the number of bytes sent to the client when the nginx responds to the client request, excluding the size of the response header. Http_referer variable: records the page from which the current request comes from. For example, if you click the hyperlink in page A to generate the request, then the url of page An is recorded in this variable. Http_user_agent variable: records the software information of the client, such as the name and version number of the browser.
# set the storage path of access log. Error_log is used to set error log.
III. Location
Priority
= exact match: before using standard uri, the request string and uri are required to match strictly. If the match succeeds, stop the match and execute the request in the location immediately. ~ regular matching: used before regular uri, indicating that uri contains regularities and is case-sensitive. ~ * regular matching: used before regular uri, it means that uri contains regularities and is not case-sensitive. ^ ~ irregular matching; used before standard uri, nginx server matching ends after matching to the uri with the most prefixes. Regular matching is not used after the pattern matching is successful. There is no normal match (\). It has nothing to do with the order of location and takes the matching result according to the length of the match. If there is an exact match, stop the match. PS: priority from high to low
1 "=" exact match
Location = / news/ {echo "test1";} [root@www quail] # curl 192.168.249.132/news/test1
2 "~" case-sensitive regular matching
Location ~\. (html) {echo 'test2';} location ~. (htmL) {echo' test3';} [root@www quail] # curl 192.168.249.132/index.htmltest2 [root@www quail] # curl 192.168.249.132/index.htmLtest3
3 "~ *" case-insensitive regular matching
Location ~ *\. (html) {echo 'test4';} [root@www quail] # curl 192.168.249.132/index.htmLtest4 [root@www quail] # curl 192.168.249.132/index.htmltest4
4 "^ ~" does not perform standard matching of regular matching, only matches prefixes
Location ^ ~ / index/ {echo 'test5';} [root@www quail] # curl 192.168.249.132/index/test5 [root@www quail] # curl 192.168.249.132/index/heiheitest5 [root@www quail] # curl 192.168.249.132/index/asdnmkalsjdtest5
5 normal matching
Location / {echo 'test6';} [root@www quail] # curl 192.168.249.132test6
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.