I, college non-trained, self-study php+js into the profession. In the 5th year, in 2 companies, the first stayed for 3 years, now this family has been 2 years. The first company learned to lnmp the basic skills of the web development front and back in the environment, learning about Python. and Java,java only part of the task in a project, and now only a vague memory.
The last 2 years after the change of work, my own planned learning route was interrupted, has been the company's business led by
: This article mainly introduces the [nginx] Daily automatic log cutting script. if you are interested in the PHP Tutorial, please refer to it.
When the daily log volume of nginx is large, it is best to automatically cut and store the logs every day, which can be used for future query and analysis.
#!/bin/sh####################filename: nginx_log_rotate.sh#vsersion: 0.1v#1 0 * * * /bin/sh /home/project/monitor/nginx_log_rotate.sh >/dev/null 2>1###################logs_path="/usr/local/
ObjectiveNGX_LUA_WAF is a Web application firewall based on Lua-nginx-module (openresty)GitHub Address:HTTPS://GITHUB.COM/LOVESHELL/NGX_LUA_WAF1 , use:Prevent SQL injection, local containment, partial overflow, fuzzing test, XSS,SSRF and other web attacksPrevent file leaks such as svn/backupsAttacks against stress test tools such as ApachebenchMask Common scan hack tool, scannerNetwork requests that mask exceptionsBlock picture Attachment class Direct
objects, send messages, etc.)Demand 2. Minimize message synchronization between servicesStatus 1. All certifications receive session information through NODEJS read user request cookieStatus 2. The common Nginx load scheme has Round-robin,least-connected,ip-hash, but these three kinds do not satisfy the demand very well, when backend increases, if uses the NODEJS official plan to synchronize with all messages between the service, Can cause a very large amount of synchronization.Solution: forwar
the module in Openresty ssl_session_fetch_by_lua_block . See Https://github.com/openresty/lua-nginx-module#ssl_session_store_by_lua_file for details.rational Use of 2.3 Ocsp staplingThe OCSP (online Certificate status Protocol, on-line Certificate Status protocol) is used to query revocation information for a certificate. OCSP real-time queries increase the client's performance overhead. Therefore, it is p
header to Image/gif.
Set some required cookie information in the response header via Set-cookie.
The reason to set a cookie is that if you want to track a unique visitor, it is common practice to generate a globally unique cookie based on the rule and plant it to the user if the client does not have the specified trace cookie on the request, otherwise the tracked cookie that is obtained in Set-cookie is placed To keep the same user cookie intact. While this is not perfect (for example,
Previous Openresty related articles, but also used to accelerate the speed of the Web page, but the last time did not optimize the code, this finishing, the optimization of nginx configuration and LUA code, interested in the words can look at the article:Https://www.cnblogs.com/w1570631036/p/8449373.htmlIn order to learn, constantly to their server loading things, is Logstash, but also Kafka, causing the main station network load, CPU consumption is t
increase will appear a lot of failure test.
Gevent is good enough, but it's a bit unscientific to be slower than Gunicorn's sync mode.
The advantage of Gunicorn is that it is easy to manage, and can be flexible to use a variety of work_class, particularly strange that the sync mode is also so fast.
The performance impact of web.py is still obvious.
The impact of the template is also obvious--mako is already a quick template, I really do not know how to use those kid slow template will be what e
Lua's performance is Super Bull, and this doesn't have to be verbose.
The application scene of Nginx_lua
Network I/O blocking time is much higher than CPU computing time, while upstream resource non bottleneck (scalable) network applications, such as High-performance network middle tier, HTTP REST interface services, etc.
Expect to simplify the system architecture, let the service to the Nginx of the Web site;
Taobao people for NG next page X_lua use summary:
Advantage:
Synchronous non-blo
Tags: center openresty data center post rest large number want to go to HTTP classReasoning, or the use of Openresty+mysql is currently the most reliable choice, no technical risk, the staff are familiar with the pit have stepped on.And the future will need to adopt Datav, and Datav is supported by MySQL RDS version, that is, we can later migrate MySQL to RDS, theoretically no problem, but may be independen
error:", err)Return-1EndEndLocal var = ngx.varLocal result = {}Result.result = 1--/usr/local/openresty/nginx/html/folder must be nobody permissions, otherwise you can not write files, error.--chown nobody:nobody/usr/local/openresty/nginx/html--Local OsFilePath = "/users/xinshaofeng/work/basketballserver/upload/"Local i = 0Local filename = NilWhile True doesLocal Typ, res, err = Form:read ()Ngx.say ("read:"
Good fast, one months later, feel that they learn less, also feel a bit of a qualitative leap.
Previously used openresty, how to say, also very valuable, high concurrency, load balancing, in some kind of small game can be a try, in fact, I have ideas,,, but used to do the game on the development of this, too no development prospects,, after all, I think, at least a lot of important programming ideas, design patterns better , after all, is not the dir
, multiple process instances are usually started on multiple servers, use Nginx as a reverse proxy server on the front end to distribute web requests and load balancing. Nginx is written in C, with better concurrency and configurability, and better support for static files. Of course, this is a common scenario of Nginx, in fact, you can directly use Nginx to build web applications, you can refer to the OpenResty Project (http://openresty.org/
).
In f
1, installation recommendations Download Openresty, package comparison, installation simple and convenient;
Download Address http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz
2. Compile and install
Tar xzvf ngx_openresty-1.7.10.1.tar.gzcd ngx_openresty-1.7.10.1./configure--with-luajitmakemake Install3. Modify Nginx config-/usr/local/openresty/nginx/conf/nginx.conf
# Add the following to the intro
Nginx Daily log volume is relatively large, it is best to automatically cut and store every day, so that you can query and analysis of the future
#!/bin/sh####################filename: nginx_log_rotate.sh#vsersion: 0.1v#1 0 * * */bin/sh/home/project/monitor/nginx_log_rotate.sh >/dev/null 2>1###################Logs_path="/usr/local/openresty/nginx/logs"Old_logs_path=${logs_path}/oldnginx_pid= ' cat/usr/local/op
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.