Tag: lua

docker工人你好世界

我试图让我的应用程序dockerize,因为我一直在官方openresty dockerfile 。 在我的系统中的操作系统是Ubuntu 16.04 64位。 我已经使用这个CMD拉图像。 docker pull openresty/openresty:1.11.2.3-xenial 现在我想使用这个图像,并希望使简单的Hello World应用程序。 为此,我创build了我的工作目录,创build一个自定义的dockerfile,并用它来构build我的自定义图像。 最后我运行这个图像。 以下是我的dockerfile内容。 FROM openresty/openresty:1.11.2.3-xenial EXPOSE 8080 CMD nginx -p `pwd` -c nginx.conf nginx.conf worker_processes 1; error_log stderr notice; events { worker_connections 1024; } http { include /usr/local/openresty/nginx/conf/mime.types; server { listen 8888; location / { default_type text/html; content_by_lua_file "app.lua"; } } } app.lua […]

如何在Alpine linux上添加用于nginx的Lua模块?

我想在启用Lua模块的情况下为nginx提供一个精简的Docker镜像。 我怎样才能创build这个基于高山linux?

点击Scrapy-splashbutton,并提交一个

为了刮我想要的网页,我需要login。login表格通过AJAX几秒钟后加载页面的其余部分(我通过检查在该网站的直接链接forms)。 我试图login像这样:def start_requests(self):yield SplashRequest('example.com',self.parse) def parse(self, response): formdata={'user': 'user', 'password':'password',} yield SplashFormRequest.from_response( response, formdata=formdata, clickdata={'name': 'commit'}, callback=self.parse1) def parse1(self,response): print(response.body.decode('utf8')) 但parse1将打印加载login表单的页面,而不是用户login后的页面。 我不确定,但这可能是因为表单是使用Ajax加载的。 如果我说得对,这意味着我需要一个lua脚本来login。 我试过这个脚本 ,像这样修改def parse (保持和链接一样的lua_script): def parse(self, response): print('\n SplashRequest js \n') yield SplashRequest( url='example.com', callback=self.parse2, method='POST', endpoint='execute', args={ 'wait': 0.5, 'lua_source': self.lua_script, 'formdata': { 'user': 'user', 'password':'password', }, } ) 但是我得到一个DEBUG: Crawled […]

openresty:高山docker集装箱内的set_by_lua&os.getenv

我在正式的 alpine-fatdocker图像中运行openresty nginx,openresty过程从nobody用户开始。 我需要设置下一个string的nginxvariables: set_by_lua $var 'return os.getenv("ENV_VAR")'; docker-compose.yml包含下一个块: build: context: . dockerfile: ./Dockerfile.nginx environment: – ENV_VAR=value 但是,nginx工作进程似乎没有得到它的价值, $var仍然是空的。 我试图添加export ENV_VAR=value到/etc/profile文件,但没有用。 我试图用nginx用户运行openresty,但是它也看不到ENV_VARvariables的值。 如果可以的话,我怎样才能使这件事情起作用?

NGINX基于环境variables的基本authentication

我正在设置一个安装了nginx-lua的docker镜像。 该场景是在分段上进行基本身份validation,但不是在生产中。 我的想法是有一个ENVvariables与阶段的名称,并检查nginx.conf文件中的值。 docker-compose.yml文件的内容(当然,对于STAGE env来说,生产环境也是一样): docs-router: build: ./nginx environment: – API_BASE_URI=staging.example.com – DOCS_STATIC_URI=docs-staging.example.com – STAGE=staging ports: – "8089:8089" – "8090:8090" nginx.conf文件的内容: … env API_BASE_URI; env DOCS_STATIC_URI; env STAGE; … http { server { listen 8089 default_server; charset utf-8; resolver 8.8.8.8; access_log off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location ~ ^(/.*\.(?:apib|svg))?$ { […]