How to install Nginx on OpenShift - nginx

Though I followed https://blog.openshift.com/lightweight-http-serving-using-nginx-on-openshift/ step by step, I ended up getting the error 503, telling me service is unavailable. There are questions on various websites, including stackoverflow, but all of them are about issues after a successful installation of nginx, a point I haven't arrived at yet.
I don't want to use already available cartridges - in part because most of them are out-of-date. Also, an answer to my question might be of interest to some people, inasmuch as it will teach how to run always the latest nginx server on OpenShift.
This is rhc tail result
DL is deprecated, please use Fiddle
==> app-root/logs/diy.log <==
[2014-12-06 16:55:47] INFO WEBrick::HTTPServer#start done.
[2014-12-06 16:55:50] INFO WEBrick 1.3.1
[2014-12-06 16:55:50] INFO ruby 1.8.7 (2013-06-27) [x86_64-linux]
[2014-12-06 16:55:50] INFO WEBrick::HTTPServer#start: pid=255959 port=8080
127.xx.x.xxx - - [06/Dec/2014:17:11:57 EST] "HEAD / HTTP/1.1" 200 0
- -> /
127.xx.x.xxx - - [06/Dec/2014:17:11:57 EST] "HEAD / HTTP/1.1" 200 0
- -> /
[2014-12-06 17:32:02] INFO going to shutdown ...
[2014-12-06 17:32:02] INFO WEBrick::HTTPServer#start done.
==> app-root/logs/server.log <==
nginx: [emerg] invalid port in ":" of the "listen" directive in /var/lib/openshi
ft/xxx/app-root/data//conf/nginx.conf:36

This guide (2012 year) uses environment variables: $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT
Now it was renamed to:
$OPENSHIFT_DIY_IP:$OPENSHIFT_DIY_PORT

If all you want is nginx on OpenShift I would use this cartridge instead
https://github.com/gsterjov/openshift-nginx-cartridge

Here's a cartridge that's updated to the most recent nginx 1.9.12

Related

Cant download GeoIP data for - Nginx >> GeoIP - 404 Error - Resolving geolite.maxmind.com (geolite.maxmind.com)

Following along the Nginx CookBook - cant seem to download GeoIP data , error in terminal as below -
/etc/nginx/geoip$ wget "http://geolite.maxmind.com/\
> download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"
--2019-10-22 15:55:46-- http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Resolving geolite.maxmind.com (geolite.maxmind.com)... 104.17.200.89, 104.17.201.89, 2606:4700::6811:c959, ...
Connecting to geolite.maxmind.com (geolite.maxmind.com)|104.17.200.89|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-10-22 15:55:48 ERROR 404: Not Found.
Kindly suggest an alternative - the GeoIP folks mention somewhere here - https://dev.maxmind.com/geoip/ , to post questions on SO .
Those databases have been discontinued. However, you can still find them on Web Archive.
http://web.archive.org/web/20181229152721/http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
You have to register for an MaxMind account now. See this Blogpost from MaxMind for more Information: https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/

Seeing GET /server-status every 10 seconds from localhost in access log

I'm using nginx for a reverse proxy in a lab environment for a POC. While looking through the nginx access.log file I see this entry every 10 seconds
127.0.0.1 - - [06/Aug/2019:02:16:50 +0000] "GET /server-status HTTP/1.1" 404 152 "-" "Go-http-client/1.1"
I'm trying to figure out what is the source of this and reason behind it. It's really just curiosity and me trying to understand more about nginx as a reverse proxy. Where else should I be looking to further understand what's going on?
Thanks!
I'm about a year late to answering, but for me this was a request made by Netdata and disabling its NGINX statistics collector removed these requests.

Gitlab cannot clone over HTTP after upgrade to 6.5

After upgrading gitlab from 6.3 to 6.5, everything looks good, except I cannot clone any repositories over HTTP. I could clone/fetch/push over SSH, and also browse the whole repositories over HTTP, but just cannot clone it over HTTP.
The error message is:
$ git clone http://mydomain/mygroup/test.git
Cloning into 'test'...
fatal: protocol error: bad line length character: 3ca
fatal: The remote end hung up unexpectedly
Any hints are appreciated.
====== More Information =======
When executing the clone as above, there are two nginx logs:
192.168.1.103 - - [26/Feb/2014:17:51:58 +0800] "GET /mygroup/test.git/info/refs?service=git-upload-pack HTTP/1.1" 200 283 "-" "git/1.8.3.4 (Apple Git-47)" "-"
192.168.1.103 - - [26/Feb/2014:17:51:58 +0800] "POST /mygroup/test.git/git-upload-pack HTTP/1.1" 200 994 "-" "git/1.8.3.4 (Apple Git-47)" "-"
And here is the error I got when trying to "git fetch" inside a project which was cloned over HTTP before:
$ git fetch
fatal: git fetch_pack: expected ACK/NAK, got '
0038ACK 12c5f4a0f130acfd8ef502a28989f42d37228016 common
0038ACK 736453e9369a9bb91b2b49b17419c168e4b61c5b common
0031ACK 736453e9369a9bb91b2b49b17419c168e4b61c5b
0022Counting objects: 114, done.
002eCompressing objects: 100% (67/67), done.
2004PACK'
Git 2.13 (Q2 2017) could add a more explicit/precise error message than expected ACK/NAK.
That would help explaining the particular clone error in the OP's case.
See commit 8e2c7be (12 Apr 2017) by Jonathan Tan (jhowtan).
(Merged by Junio C Hamano -- gitster -- in commit d2617eb, 24 Apr 2017)
fetch-pack: show clearer error message upon ERR
Currently, fetch-pack prints a confusing error message ("expected ACK/NAK") when the server it's communicating with sends a pkt-line starting with "ERR".
Replace it with a less confusing error message.
Also update the documentation describing the fetch-pack/upload-pack
protocol (pack-protocol.txt) to indicate that "ERR" can be sent in the place of "ACK" or "NAK".
In practice, this has been done for quite some
time by other Git implementations (e.g. JGit sends "want $id not valid")
and by Git itself (since commit bdb31ea: "upload-pack: report "not our ref" to client", 2017-02-23) whenever a "want" line references an object that it does not have. (This is uncommon, but can happen if a repository is garbage-collected during a negotiation.)

Redmine under sub-directory on nginx

My vhost configuration: http://pastebin.com/ZyXUmQtx (only one domain on this installation)
I've been racking my head and Google for a solution the last two days and can't quite seem to come up with a solution that works.
My setup (from the above configuration):
IP.Board 3.4 installation in %root_domain%/forums/
IP.Content 2.3 installation in %root_domain/forums/ (with external access index.php on the top-level)
Redmine 2.2.2 install at /usr/share/redmine (this is working because Thin is running and there are no errors in either log file)
Stale phpMyAdmin configuration at /usr/share/phpmyadmin/ that also kinda doesn't load html/css properly.
Symlink to /usr/share/redmine/public to /srv/www/tiberian-genesis.net/public_html/redmine
I'm trying to get redmine setup to run under %root_domain%/redmine/, but I keep getting a 404 page from my IP.Content installation.
Accessing it takes me to the url: /redmine/login?back_url=http://redmine_thin_servers/redmine/ (which now that notice it, it seems to not like my upstream...)
In case someone requests the Thin configuration file:
---
pid: /var/run/thin/redmine.pid
group: tgmod
prefix: /redmine
timeout: 30
log: /var/log/thin/redmine.log
max_conns: 1024
require: []
max_persistent_conns: 512
environment: production
user: tgmod
servers: 1
daemonize: true
chdir: /usr/share/redmine
socket: /var/run/thin/redmine.sock
I'm out of ideas here.
Thanks in advance!
I just ended up setting it up on a sub-domain. I wanted to try to proxy it on a sub-directory, but my main website kept interfering with the rules.

Why does Passenger 3.0 with nginx crash on startup(?) then 403s?

On Ubuntu with REE 1.8.7, with nginx 0.8.53 manually compiled with the
Passenger 3 module doc installed as per the docs, I get an error in
the nginx error log when nginx starts:
Unable to start the Phusion Passenger watchdog because it encountered
the following error during startup: Unable to start the Phusion
Passenger logging agent: an error occurred while sending startup
arguments: Broken pipe (32) (-1: Unknown error 18446744073709551615)
I assume this means nginx never starts properly. When I try and view
my site after this, I get a 403.
2010/10/22 00:56:47 [error] 13874#0: *1813942 directory index of "/var/
rails/myapp/current/public/" is forbidden, client: 125.197.115.16,
server: new.myapp.fm, request: "GET / HTTP/1.1", host: "new.myapp.fm"
I expect the first is probably causing the second. I haven't had any
luck googling this. Can anyone provide insight or help me
troubleshoot?
I got this after upgrading to Passenger 3.0.1 as I had not changed the version of Passenger specified by passenger_root in /opt/nginx/conf/nginx.conf. You might need to change the line that looks like this to specify the correct version:
passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-3.0.1;
You get told to do this when you install nginx. Hope that helps.
I ran into this problem too, and it was because passenger couldn't find ruby:
tail -f /var/log/nginx/error.log
2011/12/20 00:54:45 [alert] 30300#0: Unable to start the Phusion Passenger watchdog because it encountered the following error during startup: Unable to start the Phusion Passenger helper agent: it seems to have crashed during startup for an unknown reason, with exit code 1 (-1: Unknown error)
* Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: ruby: No such file or directory (2)
Even though ruby was properly listed within the system PATH, it didn't seem to work right until I added:
passenger_ruby = /usr/local/bin/ruby;
(the location of my ruby executable) into the http section of my nginx config.
The problem was that PassengerLoggingAgent wasn't installed when I did 'gem install passenger'. I installed it as per this discussion (by grabbing it from the standalone zip) and everything is fine now: http://groups.google.com/group/phusion-passenger/browse_thread/thread/323dc1c7b0e5ee11

Resources