Configure NginX: Difference between revisions
Jump to navigation
Jump to search
imported>Jacob No edit summary |
imported>Jacob No edit summary |
||
| Line 11: | Line 11: | ||
># vim /usr/local/etc/nginx/nginx.conf | ># vim /usr/local/etc/nginx/nginx.conf | ||
server { | server { | ||
listen 10.0.0.68:80; | listen 10.0.0.68:80; | ||
server_name poudriere.sjakio.com; | server_name poudriere.sjakio.com; | ||
root /usr/local/share/poudriere/html; | root /usr/local/share/poudriere/html; | ||
# Allow caching static resources | # Allow caching static resources | ||
location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ { | location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ { | ||
| Line 21: | Line 21: | ||
expires 2d; | expires 2d; | ||
} | } | ||
location /data { | location /data { | ||
alias /usr/local/poudriere/data/logs/bulk; | alias /usr/local/poudriere/data/logs/bulk; | ||
# Allow caching dynamic files but ensure they get rechecked | # Allow caching dynamic files but ensure they get rechecked | ||
location ~* ^.+\.(log|txz|tbz|bz2|gz)$ { | location ~* ^.+\.(log|txz|tbz|bz2|gz)$ { | ||
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | ||
} | } | ||
# Don't log json requests as they come in frequently and ensure | # Don't log json requests as they come in frequently and ensure | ||
# caching works as expected | # caching works as expected | ||
| Line 37: | Line 37: | ||
log_not_found off; | log_not_found off; | ||
} | } | ||
# Allow indexing only in log dirs | # Allow indexing only in log dirs | ||
location ~ /data/?.*/(logs|latest-per-pkg)/ { | location ~ /data/?.*/(logs|latest-per-pkg)/ { | ||
autoindex on; | autoindex on; | ||
} | } | ||
break; | break; | ||
} | } | ||
location /packages { | location /packages { | ||
alias /usr/local/poudriere/data/packages; | alias /usr/local/poudriere/data/packages; | ||
# Allow caching dynamic files but ensure they get rechecked | # Allow caching dynamic files but ensure they get rechecked | ||
location ~* ^.+\.(log|txz|tbz|bz2|gz)$ { | location ~* ^.+\.(log|txz|tbz|bz2|gz)$ { | ||
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | ||
} | } | ||
# Don't log json requests as they come in frequently and ensure | # Don't log json requests as they come in frequently and ensure | ||
# caching works as expected | # caching works as expected | ||
| Line 61: | Line 61: | ||
log_not_found off; | log_not_found off; | ||
} | } | ||
# Allow indexing only in log dirs | # Allow indexing only in log dirs | ||
location ~ /data/?.*/(logs|latest-per-pkg)/ { | location ~ /data/?.*/(logs|latest-per-pkg)/ { | ||
autoindex on; | autoindex on; | ||
} | } | ||
break; | break; | ||
} | } | ||
listen 127.0.0.1:80; | listen 127.0.0.1:80; | ||
Start the server. | Start the server. | ||
Revision as of 17:10, 11 January 2020
Previous Create SSL Certificate and Key Next Create first poudriere set
Review the nginx.xonf file
The sample setup for for poudriere in /usr/local/share/examples/poudriere/nginx.conf.sample
Then edit the nginx.conf file and add the red sections
># vim /usr/local/etc/nginx/nginx.conf
server {
listen 10.0.0.68:80;
server_name poudriere.sjakio.com;
root /usr/local/share/poudriere/html;
# Allow caching static resources
location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ {
add_header Cache-Control "public";
expires 2d;
}
location /data {
alias /usr/local/poudriere/data/logs/bulk;
# Allow caching dynamic files but ensure they get rechecked
location ~* ^.+\.(log|txz|tbz|bz2|gz)$ {
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Don't log json requests as they come in frequently and ensure
# caching works as expected
location ~* ^.+\.(json)$ {
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
}
# Allow indexing only in log dirs
location ~ /data/?.*/(logs|latest-per-pkg)/ {
autoindex on;
}
break;
}
location /packages {
alias /usr/local/poudriere/data/packages;
# Allow caching dynamic files but ensure they get rechecked
location ~* ^.+\.(log|txz|tbz|bz2|gz)$ {
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Don't log json requests as they come in frequently and ensure
# caching works as expected
location ~* ^.+\.(json)$ {
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
}
# Allow indexing only in log dirs
location ~ /data/?.*/(logs|latest-per-pkg)/ {
autoindex on;
}
break;
}
listen 127.0.0.1:80;
Start the server.
># service nginx start
Now connect to http://sjapkg.sjakio.com and check that we have a function website
Previous Create SSL Certificate and Key Next Create first poudriere set