Configure NginX: Difference between revisions

From wiki
Jump to navigation Jump to search
imported>Jacob
No edit summary
No edit summary
 
(13 intermediate revisions by one other user not shown)
Line 6: Line 6:
<hr><p style="text align:left;">
<hr><p style="text align:left;">


Review the nginx.xonf file<br>
Setup nginx.xonf file<br>
The sample setup for for poudriere in /usr/local/share/examples/poudriere/nginx.conf.sample
The sample setup for for poudriere in /usr/local/share/examples/poudriere/nginx.conf.sample. If that is the only server on the host, copy to /usr/local/etc/nginx/nginx.conf
Then edit the nginx.conf file and add the red sections
># cp /usr/local/share/examples/poudriere/nginx.conf.sample /usr/local/etc/nginx/00_mypkg.conf
Then edit the nginx.conf file and include the file.
  ># vim /usr/local/etc/nginx/nginx.conf
  ># vim /usr/local/etc/nginx/nginx.conf
    server {
        ...
        include /usr/local/etc/nginx/00_mypkg.conf;


        listen       10.0.0.68:80;
Modify the listen and name parts in 00_mypkg.conf
        server_name poudriere.sjakio.com;
  ># vim /usr/local/etc/nginx/00_mypkg.conf
        root        /usr/local/share/poudriere/html;
         ...
 
        listen      192.168.1.99:80;
        # Allow caching static resources
         server_name  mypkg.example.com;
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ {
         ...
            add_header Cache-Control "public";
Start the server<br>
            expires 2d;
># service php-fpm start
        }
 
         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
  ># service nginx start


Now connect to http://sjapkg.sjakio.com and check that we have a function website
Now connect to http://mypkg.example.com and check that we have a function website
 
 




<hr><p style="text align:left;">
<hr>
<p style="text align:left;">
Previous [[Create SSL Certificate and Key]]
Previous [[Create SSL Certificate and Key]]
<span style="float:right;">
<span style="float:right;">
Next [[Create first poudriere set]]
Next [[Create first poudriere set]]
</span></p>
</span></p>
<center> Up [[Poudriere setup]]</center>
<hr>

Latest revision as of 09:24, 20 March 2021


Previous Create SSL Certificate and Key Next Create first poudriere set


Setup nginx.xonf file
The sample setup for for poudriere in /usr/local/share/examples/poudriere/nginx.conf.sample. If that is the only server on the host, copy to /usr/local/etc/nginx/nginx.conf

># cp /usr/local/share/examples/poudriere/nginx.conf.sample /usr/local/etc/nginx/00_mypkg.conf

Then edit the nginx.conf file and include the file.

># vim /usr/local/etc/nginx/nginx.conf
       ...
       include /usr/local/etc/nginx/00_mypkg.conf;

Modify the listen and name parts in 00_mypkg.conf

># vim /usr/local/etc/nginx/00_mypkg.conf
       ...
       listen       192.168.1.99:80;
       server_name  mypkg.example.com;
       ...

Start the server

># service php-fpm start
># service nginx start

Now connect to http://mypkg.example.com and check that we have a function website



Previous Create SSL Certificate and Key Next Create first poudriere set

Up Poudriere setup