{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/3534","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/events","html_url":"https://github.com/balderdashy/sails/issues/3534","id":129785781,"number":3534,"title":"Change path to static files on layout file","user":{"login":"jasalazar","id":8170705,"avatar_url":"https://avatars.githubusercontent.com/u/8170705?v=3","gravatar_id":"","url":"https://api.github.com/users/jasalazar","html_url":"https://github.com/jasalazar","followers_url":"https://api.github.com/users/jasalazar/followers","following_url":"https://api.github.com/users/jasalazar/following{/other_user}","gists_url":"https://api.github.com/users/jasalazar/gists{/gist_id}","starred_url":"https://api.github.com/users/jasalazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasalazar/subscriptions","organizations_url":"https://api.github.com/users/jasalazar/orgs","repos_url":"https://api.github.com/users/jasalazar/repos","events_url":"https://api.github.com/users/jasalazar/events{/privacy}","received_events_url":"https://api.github.com/users/jasalazar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-29T14:47:55Z","updated_at":"2016-01-30T00:59:54Z","closed_at":null,"body":"Good morning everyone.\r\n\r\nI realized that when my layout file includes CSS and JS files this way:\r\n\r\n`<link rel=\"stylesheet\" href=\"/styles/bootstrap.css\">`\r\n`<script src=\"/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nThey are not rendered when using them behind Nginx as a proxy.\r\n\r\nBut when i edit the injection in my layout file this way:\r\n\r\n`<link rel=\"stylesheet\" href=\"/assets/styles/bootstrap.css\">`\r\n`<script src=\"/assets/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nThey are properly rendered.\r\n\r\nI've tried several options in my Nginx server configuration file to render CSS and JS files, but it wont work.\r\n\r\nMy question is: Can i edit the path that will be shown in my layout file to become like this?:\r\n\r\n`<link rel=\"stylesheet\" href=\"/assets/styles/bootstrap.css\">`\r\n`<script src=\"/assets/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nIf so: Where?\r\n\r\nPS: It works either way while running my app only on lifting sails server.\r\n\r\nThanks a lot!"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails/issues/comments/177035388","html_url":"https://github.com/balderdashy/sails/issues/3534#issuecomment-177035388","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/3534","id":177035388,"user":{"login":"odnarb","id":8440432,"avatar_url":"https://avatars.githubusercontent.com/u/8440432?v=3","gravatar_id":"","url":"https://api.github.com/users/odnarb","html_url":"https://github.com/odnarb","followers_url":"https://api.github.com/users/odnarb/followers","following_url":"https://api.github.com/users/odnarb/following{/other_user}","gists_url":"https://api.github.com/users/odnarb/gists{/gist_id}","starred_url":"https://api.github.com/users/odnarb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odnarb/subscriptions","organizations_url":"https://api.github.com/users/odnarb/orgs","repos_url":"https://api.github.com/users/odnarb/repos","events_url":"https://api.github.com/users/odnarb/events{/privacy}","received_events_url":"https://api.github.com/users/odnarb/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T00:59:54Z","updated_at":"2016-01-30T00:59:54Z","body":"We're essentially bypassing sails.js from serving any static files. Nginx, I think, handles that faster. Besides, if you have logging on per request, it saves sails.js from creating a log entry for accessing static assets.\r\n\r\nNginx config:\r\n```\r\n    # this prevents hidden files (beginning with a period) from being served\r\n    location ~ /\\.          { access_log off; log_not_found off; deny all; }\r\n\r\n    location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|styles/|fonticons/|font-awesome/|fonts/|bin/|swf/|flash/|media/|static/) {\r\n        root /opt/mysails/.tmp/public;\r\n        access_log off;\r\n        expires -1;\r\n    }\r\n  # other rules for robots.txt, etc. as needed\r\n\r\n#custom static error page when sails is down\r\n    error_page 502 504 /502.html;\r\n\r\n    location /502.html {\r\n        root /opt/mysails/views/static;\r\n    }\r\n```\r\n\r\nThen our paths can be like this in layout.ejs:\r\n```html\r\n    <script src=\"/js/jquery-2.1.1.js\"></script>\r\n    <link href=\"/styles/style.min.css\" rel=\"stylesheet\">\r\n```"}}