Skip to content

Change the nginx config to use a shared folder for resources #11

Description

@jbriones1

Due to the domain splitting work being done #17, there will be a lot of duplicated assets since none of the domains are set to access anything outside of their root folder. To remedy this, we should add a shared resource folder to the /var/www/html folder that all of the sites can access.

This will require:

  • Changing the Frontend repos build process to include creating a shared or static folder which will contain all the shared assets
/var/www/html
├── shared // new folder that contains shared assets
│   └── js
│   └── css
│   └── components // common web components for static sites
│   └── images // all images
├── ng
│   └── // The Angular app stuff, I'll figure this part out later
├── <subdomain>
  • Updating nginx.conf to have every site have access to this static folder, looking like this:
# nginx.conf
server {
    server_name <subdomain>.sfucsss.org;
    root /var/www/html/<subdomain>;

    location / {
        # subdomain stuff
    }

    location /shared/ {
        alias /var/www/html/shared/;
       ...
    }
}
  • Update the links in the static sites to access this shared resource
<!-- *.html -->
<link rel="stylesheet" href="/shared/css/...">
<script src="/shared/js/..."></script>
<img src="/shared/images/..." />
 /* *.css */
div {
    background-image: url('/shared/<path to file>');
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions