Nginx/Passenger: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| (5 intermediate revisions by the same user not shown) | |||
| Line 113: | Line 113: | ||
|valign='top'| | |valign='top'| | ||
{|class='wikitable mw-collapsible mw-collapsed' | {|class='wikitable mw-collapsible mw-collapsed' | ||
!scope='col' style='text-align:left' colspan='2'| | !scope='col' style='text-align:left' colspan='2'| How » Install | ||
How » Install | |||
|- | |- | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
| Line 180: | Line 179: | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
|} | |} | ||
{|class='wikitable mw-collapsible | {|class='wikitable mw-collapsible' | ||
!scope='col' style='text-align:left' colspan='2'| | !scope='col' style='text-align:left' colspan='2'| How » Config | ||
How » Config | |||
|- | |- | ||
|valign='top' colspan='2'| | |valign='top' colspan='2'| | ||
| Line 226: | Line 224: | ||
passenger-config validate-install --auto;echo | passenger-config validate-install --auto;echo | ||
passenger-memory-stats --no-apache;echo | passenger-memory-stats --no-apache;echo | ||
passenger-config about ruby-command | passenger-config about ruby-command;echo | ||
passenger-status | |||
EXE | EXE | ||
INI | |||
</syntaxhighlight> | |||
|} | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left'| How » Nginx | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='nginx' highlight='22,23,46-49' line> | |||
cat <<'INI' | tee /etc/nginx/sites-available/academia.chorke.org >/dev/null | |||
server { | |||
listen 80; | |||
server_name academia.chorke.org; | |||
# allow letsencrypt http validation | |||
location /.well-known/acme-challenge/ { | |||
root /var/www/html; | |||
} | |||
return 301 https://academia.chorke.org$request_uri; | |||
} | |||
server { | |||
listen 443 ssl; | |||
server_name academia.chorke.org; | |||
ssl_certificate /etc/letsencrypt/live/academia.chorke.org/fullchain.pem; | |||
ssl_certificate_key /etc/letsencrypt/live/academia.chorke.org/privkey.pem; | |||
ssl_protocols TLSv1.2 TLSv1.3; | |||
passenger_spawn_method smart; | |||
passenger_min_instances 3; | |||
gzip_comp_level 3; | |||
gzip on; | |||
gzip_vary on; | |||
gzip_proxied any; | |||
gzip_http_version 1.0; | |||
gzip_min_length 1100; | |||
gzip_buffers 64 8k; | |||
gzip_disable "msie6"; | |||
gzip_types text/css text/xml application/x-javascript application/atom+xml text/mathml text/plain text/vnd.sun.j2me.app-descriptor text/vnd.wap.wml text/x-component image/bmp image/svg+xml image/x-icon; | |||
root /home/deploy/sites/academia.chorke.org/production/current/public; | |||
access_log /home/deploy/sites/academia.chorke.org/production/current/log/nginx.access.log; | |||
error_log /home/deploy/sites/academia.chorke.org/production/current/log/nginx.error.log info; | |||
# allow letsencrypt https validation | |||
location /.well-known/acme-challenge/ { | |||
root /var/www/html; | |||
} | |||
location ~ / { | |||
alias /home/deploy/sites/academia.chorke.org/production/current/public; | |||
passenger_ruby /home/deploy/.rbenv/versions/3.3.5/bin/ruby; | |||
passenger_app_env production; | |||
passenger_max_request_queue_size 200; | |||
passenger_enabled on; | |||
} | |||
location ~* ^.+\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$ { | |||
add_header Cache-Control "public, max-age=31536000, must-revalidate"; | |||
} | |||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { | |||
add_header Cache-Control public; | |||
expires max; | |||
} | |||
location ^~ /assets/ { | |||
add_header Cache-Control public; | |||
expires max; | |||
gzip_static on; | |||
} | |||
location /mfa/otp { | |||
limit_req zone=otp-zone burst=1 nodelay; | |||
limit_req_log_level error; | |||
limit_req_status 429; | |||
} | |||
keepalive_timeout 10; | |||
client_max_body_size 10M; | |||
try_files $uri/index.html $uri; | |||
error_page 500 502 503 504 /500.html; | |||
} | |||
INI | INI | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 23:29, 7 February 2026
| |||
cat <<'EXE' | sudo bash
apt-get update;echo
apt-get install -y nginx libnginx-mod-http-passenger
/usr/bin/passenger_free_ruby -v
which passenger;echo
passenger version
apt-get clean
EXE
|
|||
| |||
Passenger » Why
|
Passenger » Why | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||
Passenger » How
|
Passenger » How | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
References
|
References | ||
|---|---|---|