Last active
December 22, 2015 20:34
-
-
Save suzumura-ss/fc6073b25194cf05c507 to your computer and use it in GitHub Desktop.
build ngx_openresty with passenger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
sudo yum -y install gcc openssl-devel zlib-devel pcre-devel lua lua-devel | |
sudo yum -y install ruby-devel curl-devel gcc-c++ | |
wget https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz | |
tar xf ngx_openresty-1.9.3.2.tar.gz | |
gem install passenger | |
ruby build.rb | |
=end | |
require 'fileutils' | |
nginx = Dir["ngx_openresty-*"].select{|d| File.directory?(d)}.sort[-1] | |
Dir.chdir(nginx) | |
# for passenger support | |
unless ENV['GEM_HOME'] | |
ENV['GEM_HOME'] = "/usr/local/share/ruby/gems/2.0" | |
end | |
passenger = Dir["#{ENV['GEM_HOME']}/gems/passenger*"].sort[-1] + '/src/nginx_module' | |
passenger_name = passenger.split("/")[-3] | |
unless File.exist?("bundle/#{passenger_name}") | |
FileUtils.cp_r(passenger, "bundle/#{passenger_name}") | |
end | |
IO.popen('patch', 'r+'){|io| | |
io.puts <<__PATCH__ | |
--- configure.0 2015-12-22 07:25:40.800404406 +0000 | |
+++ configure 2015-12-22 07:26:03.648964560 +0000 | |
@@ -88,6 +88,7 @@ | |
#[http_auth_request => 'auth-request-nginx-module'], | |
[http_rds_json => 'rds-json-nginx-module'], | |
[http_rds_csv => 'rds-csv-nginx-module'], | |
+ [passenger => 'passenger'], | |
); | |
__PATCH__ | |
io.close_write | |
while l = io.gets | |
puts l | |
end | |
} | |
p(nginx:nginx, passenger:passenger, name:passenger_name) | |
system <<__CONF__ | |
./configure \ | |
--prefix='/opt/nginx' \ | |
--with-http_ssl_module \ | |
--with-http_gzip_static_module \ | |
--with-http_stub_status_module \ | |
--with-http_auth_request_module \ | |
--with-luajit | |
__CONF__ | |
exit 1 unless $?.exitstatus==0 | |
system <<__MAKE__ | |
make -j && sudo make install | |
__MAKE__ | |
exit $?.exitstatus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment