Enabling gzip for external http requests - wordpress

I have a local env that is not automatically decompressing deflated files. The staging server and the production server seem to be doing it automatically (because the code we have up there is working fine) but on my local machine the request body is still compressed. I had some success using:
gzinflate()
but I would rather find a solution where my local set up is just closer to the production set up (and don't have to change the code all that much).
p.s. this is a wordpress set up.

K I figured it out. Turns out the issue was that I had just updated my local env to php 7 and enabled x-debug. When doing this I also needed to install something for SOAP and CURL requests (if someone would like to explain further I would be appreciative). Here is the command I had to run:
sudo apt-get install php-soap php-curl

Related

Unable to change options for ngx_pagespeed

I was able to successfully add ngx_pagespeed to my Nginx server at Digital Ocean. I did an automated install per this: https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source
The module works - for example I can see it is automatically converting my .jpg images to .webp. Also, curl -I -p http://localhost| grep X-Page-Speed returns the X-Page-Speed: 1.13.35.2-0 header.
However, I’m not able to edit any options. When I try to run something like pagespeed rewrite_images on, or even pagespeed on, I get an error pagespeed: command not found.
Per documentation pagespeed should be the command for Nginx: https://modpagespeed.com/doc/configuration
I tried a couple of other commands:
whereis pagespeed returns pagespeed:
which pagespeed returns nothing.
As far as I know these should be returning the full path, something like /usr/bin/pagespeed
Problem was that for some reason I thought pagespeed flags were turned on/off via terminal commands. This assumption is wrong. It actually needs to be done as Nginx directives, added to nginx.conf file and restart the Nginx server.

Update .py file on nginx, gunicorn, supervisor

I don't know why this is so difficult, but everytime I update a file in my flask application I have to restart gunicorn so that the file updates on the server. I am mostly a front-end developer and don't play with servers enough to remember these things, and I have to spend hours google searching various phrases to find the right commands. This time I can't seam to find anything, and the file I created to save these things has conveniently disappeared.
My server:
Ubuntu 18.04
nginx
gunicorn
supervisor
I am updating a .py file. I placed the updated version on the server using ftp. I'm logged into the server, using ssh, through a git bash shell. sudo systemctl gunicorn restart give me the error Failed to restart gunicorn.service: Unit gunicorn.service not found.. Rereading and restarting supervisor does not do the trick, and neither does restarting nginx. Is there not a simple command to apply updates? I'm use to using servers on general hosting sites, and updating a file via ftp just works. I was really enjoying learning flask up until this point, but now I regret it. I keep thinking that there has to be some kind of simple trick to make such a simple thing go smoothly, but I'm at the end of my rope trying to figure this out. Any suggestions?
I finally found it.
sudo supervisorctl stop app_name
sudo supervisorctl start app_name

Change Jenkins basepath

I'm trying to serve a stock jenkins installation (on Amazon Linux AMI) thru myjenkinsinstance:8080/jenkins (rather than myjenkinsinstance:8080), and then proxy this with e.g. Nginx (over HTTP).
This question has been 'answered' before, but the solution doesn't seem to be relevant anymore.
#admins I would prefer to comment on that thread (specifically this 'answer'), rather than opening a duplicate, but I am not allowed to, per my 'reputation' score (as my comment would not be a solution at all, but further request for help).
From the closest thing to an answer I've seen:
Go to Jenkins Home Directory ( I have mine in C:\Jenkins)
Edit jenkins.xml
Add this --prefix=/jenkins to the end of the argument as show below and restart the jenkins service ALL worked OK for me !
Example : <arguments>-Xrs-Xmx256mDhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --prefix=/jenkins</arguments>
Open Url http://localhost:8080/jenkins this should bring up the home page of jenkins
there is no 'jenkins.xml' in the $JENKINS_HOME directory, but there is a config.xml
there is no <arguments/> entry in the config.xml
there seems to be no other configuration for the initial installation
There's also a 'Jenkins Location > Jenkins URL' setting in the "Configure System" settings (myjenkinsinstance/configure), but modifying this seems to have no noticeable affect.
The end goal would be to automate this installation via e.g. CloudFormation (as part of the EC2's UserData).
Any suggestions would be greatly appreciated.
On your linux system, you need to find the jenkins default config file located at
/etc/default/jenkins
and then add the following arguments according to your requirements. This is a rough idea.
JENKINS_ARGS="--webroot=/var/cache/jenkins/war --prefix=/jenkins
--httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
This should work most likely. If it doesnt, pls update your answer with the current arguments present. This works fine for Debian/Ubuntu.
Also you are running jenkins on your windows machine or linux?
So my 'solution' was to use sed and insert some lines into /etc/nginx/nginx.conf and /etc/init.d/jenkins.
e.g.
sed -i '/^ location \/ {/aproxy_pass http://127.0.0.1:8080/;' /etc/nginx/nginx.conf
sed -i '/^PARAMS=/ s/"$/ --prefix=\/jenkins"/' /etc/init.d/jenkins
I highly doubt this is anything near a 'best practice', but it seems to work for now (what happens were I to update with yum... I'm not sure, but the plan is to back the instance with an Elastic Filesystem, which hopefully will allow us to consider the jenkins instance ephemeral, anyway).

Using luac file on Nginx

I have been experimenting with using Lua in Nginx - quite a neat little capability which I can use effectively. However, one of my concerns relates to IP protection so I thought I would use an online tool to compile my, fully tested, LUA script. I tried https://luac.mtasa.com/.
I uploaded the file to my server, changed by /etc/nginx/sites-available/default file to use the luac* instead of the orginal lua and reloaded nginx. However, when I attempt to browse to the resource that is being serviced by that lua(c) I get the error log message *70 failed to load external Lua file... : bad byte code header. How should this be interpreted? The options are
That particular online compiler is not generating a valid luac.
The nginx/lua combo does not understand that particular luac.
I should mention that I am using Nginx 1.6.2 on Ubuntu 14.10 (64 bit). I installed Lua enabled Nginix via apt-get install nginx-extras.
I am a beginner here.
Compiling lua for nginx has some specifics. You could see details on official Lua module page http://wiki.nginx.org/HttpLuaModule#Lua.2FLuaJIT_bytecode_support

meteor application: how to get access log / error log like Apache server?

is it possible to see access log / and Apache log as we see for Apache server to check what going with meteor server. ? can i look it as a domain or as a whole servers?
If you are using meteor-up to deploy your applications into your own server (which I recommend and should save you a lot of time on the long run), you can access your logs at: /var/log/upstart/app.log.
This will even allow you to tail logs from the server in your local application directory by running:
mup logs -f # it supports all the options of tail
Also, if you want to reset your logs:
cd /var/log/upstart/
sudo cat /dev/null > app.log
well, depends on how fancy you want to go, it could be as simple as:
meteor > /var/log/meteor.log
it redirect the output to /var/log/meteor.log
if that doesnt float your boat, there are a bunch of packages pre-made for that, of which this one looks like the most flexible:
https://atmospherejs.com/package/trail

Resources