Use nginx to serve static files from subdirectories of a given directory - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (/opensearch.xml) (https://stackoverflow.com/questions/12806893/use-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) (https://cdn.sstatic.net/Shared/stacks.css?v=d6a266655a25) (https://cdn.sstatic.net/Sites/stackoverflow/primary.css?v=22fb2cb11723) (Feed for question 'Use nginx to serve static files from subdirectories of a given directory') (/feeds/question/12806893) (https://cdn.sstatic.net/Shared/Channels/channels.css?v=5981bb1a5bd7) (https://accounts.google.com/gsi/style) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (/legal/terms-of-service/public) terms of service and acknowledge you have read our (/legal/privacy-policy) privacy policy . (59e99b481907aca79504282706e4b1db65c79b5bb11a4cbc1d88997106647265) (1) (2.0) Sign up with Google Sign up with GitHub OR (59e99b481907aca79504282706e4b1db65c79b5bb11a4cbc1d88997106647265) (1) () () () () () () Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (/users/login) Log in (59e99b481907aca79504282706e4b1db65c79b5bb11a4cbc1d88997106647265) () Skip to main content (https://stackoverflow.com) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav-bar&utm_content=overflowai) OverflowAI (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-for-teams) Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-advertising) Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-ai) OverflowAI GenAI features for Teams (https://stackoverflow.co/api-solutions/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-api) OverflowAPI Train & fine-tune LLMs (https://stackoverflow.co/labs/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=labs) Labs The future of collective knowledge sharing (https://stackoverflow.co/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=about-the-company) About the company (https://stackoverflow.blog/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=blog) Visit the blog (Search…) () Loading… (https://stackoverflow.com) current community (https://stackoverflow.com) (Stack Overflow) Stack Overflow (https://stackoverflow.com/help) help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) chat (https://meta.stackoverflow.com) (Meta Stack Overflow) Meta Stack Overflow your communities (https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f12806893%2fuse-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) Sign up or (https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f12806893%2fuse-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) log in to customize your list. (https://stackexchange.com/sites) more stack exchange communities (https://stackoverflow.blog) company blog (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f12806893%2fuse-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f12806893%2fuse-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json python-3.x .net ruby-on-rails sql-server swift django angular objective-c excel pandas angularjs regex typescript ruby linux ajax iphone vba xml laravel spring asp.net-mvc database wordpress string flutter postgresql mongodb wpf windows amazon-web-services xcode bash git oracle-database spring-boot dataframe azure firebase list multithreading docker vb.net react-native eclipse algorithm powershell macos visual-studio numpy image forms scala function vue.js performance twitter-bootstrap selenium winforms kotlin loops express dart hibernate sqlite matlab python-2.7 shell rest apache entity-framework android-studio csv maven api linq qt dictionary unit-testing asp.net-core facebook tensorflow apache-spark file swing class unity-game-engine sorting date authentication go symfony t-sql opencv matplotlib .htaccess google-chrome for-loop datetime codeigniter http perl validation sockets google-maps object uitableview xaml oop if-statement visual-studio-code cordova ubuntu web-services email android-layout github spring-mvc elasticsearch kubernetes selenium-webdriver ms-access user-interface parsing ggplot2 pointers google-sheets machine-learning c++11 security google-apps-script flask ruby-on-rails-3 templates nginx variables exception sql-server-2008 gradle debugging tkinter listview delphi jpa asynchronous pdf web-scraping haskell jsp ssl amazon-s3 google-cloud-platform jenkins testing xamarin wcf npm batch-file generics ionic-framework network-programming unix recursion google-app-engine mongoose visual-studio-2010 .net-core android-fragments assembly animation math next.js session svg hadoop intellij-idea curl django-models join rust winapi laravel-5 url heroku http-redirect tomcat google-cloud-firestore inheritance webpack keras image-processing gcc asp.net-mvc-4 logging dom web swiftui matrix pyspark actionscript-3 button post optimization firebase-realtime-database jquery-ui iis cocoa xpath d3.js javafx firefox internet-explorer xslt caching select asp.net-mvc-3 opengl events asp.net-web-api plot dplyr magento encryption search stored-procedures amazon-ec2 ruby-on-rails-4 memory audio canvas multidimensional-array jsf random vector cookies redux input facebook-graph-api flash xamarin.forms indexing arraylist ipad cocoa-touch data-structures video apache-kafka model-view-controller serialization jdbc woocommerce azure-devops routes razor awk servlets mod-rewrite beautifulsoup docker-compose excel-formula filter iframe aws-lambda design-patterns text django-rest-framework visual-c++ cakephp mobile android-intent react-hooks struct methods groovy mvvm ssh lambda checkbox ecmascript-6 google-chrome-extension time grails installation sharepoint cmake shiny spring-security jakarta-ee android-recyclerview plsql core-data types meteor android-activity sed bootstrap-4 websocket activerecord graph replace scikit-learn file-upload group-by vim junit boost deep-learning import sass memory-management error-handling async-await eloquent dynamic soap silverlight dependency-injection charts layout apache-spark-sql deployment browser gridview svn while-loop google-bigquery vuejs2 ffmpeg dll highcharts view foreach plugins makefile c#-4.0 redis reporting-services jupyter-notebook merge server unicode https reflection google-maps-api-3 twitter oauth-2.0 extjs pytorch axios terminal pip split mysqli cmd encoding django-views automation database-design collections hash netbeans build data-binding ember.js tcp sqlalchemy pdo apache-flex concurrency entity-framework-core command-line spring-data-jpa printing react-redux java-8 jestjs service html-table lua neo4j ansible material-ui parameters module enums visual-studio-2012 flexbox promise outlook webview firebase-authentication web-applications uwp jquery-mobile utf-8 datatable python-requests parallel-processing drop-down-menu colors scroll hive scipy tfs count syntax ms-word twitter-bootstrap-3 ssis google-analytics fonts three.js powerbi rxjs constructor graphql file-io paypal discord cassandra socket.io graphics compiler-errors gwt react-router nlp solr url-rewriting backbone.js memory-leaks datatables oauth terraform datagridview drupal oracle11g zend-framework neural-network knockout.js triggers django-forms interface angular-material google-api casting jmeter linked-list path proxy timer django-templates arduino orm directory visual-studio-2015 parse-platform windows-phone-7 cron push-notification conditional-statements primefaces functional-programming pagination model jar xamarin.android hyperlink uiview gitlab visual-studio-2013 vbscript google-cloud-functions azure-active-directory jwt download swift3 sql-server-2005 configuration process pygame rspec properties combobox callback windows-phone-8 linux-kernel safari permissions scrapy raspberry-pi scripting emacs clojure x86 scope io compilation mongodb-query nhibernate responsive-design expo angularjs-directive azure-functions request bluetooth dns 3d binding reference discord.js architecture playframework pyqt version-control doctrine-orm package get sql-server-2012 rubygems f# autocomplete openssl datepicker kendo-ui tree jackson pycharm controller yii nested grep xamarin.ios static dockerfile statistics transactions datagrid null active-directory uiviewcontroller webforms phpmyadmin discord.py notifications computer-vision sas duplicates mocking youtube nullpointerexception yaml menu sum bitmap blazor asp.net-mvc-5 electron visual-studio-2008 time-series yii2 jsf-2 css-selectors stl android-listview floating-point cryptography ant stream hashmap character-encoding msbuild sdk asp.net-core-mvc google-drive-api selenium-chromedriver jboss joomla cors navigation devise anaconda background camera multiprocessing pyqt5 binary cuda frontend linq-to-sql iterator mariadb onclick plotly ios7 rabbitmq android-jetpack-compose android-asynctask microsoft-graph-api tabs insert laravel-4 uicollectionview environment-variables amazon-dynamodb linker console xsd coldfusion upload continuous-integration ftp textview opengl-es operating-system vuejs3 mockito localization macros formatting xml-parsing json.net kivy type-conversion data.table timestamp calendar integer segmentation-fault android-ndk drag-and-drop prolog char crash jasmine automated-tests dependencies geometry android-gradle-plugin itext firebase-cloud-messaging header fortran sprite-kit mfc attributes nuxt.js nosql format azure-pipelines nestjs odoo db2 jquery-plugins jenkins-pipeline leaflet event-handling flutter-layout julia postman annotations keyboard textbox arm visual-studio-2017 gulp libgdx stripe-payments xampp synchronization crystal-reports timezone dom-events uikit azure-web-app-service android-emulator swagger wso2 sequelize.js namespaces aggregation-framework uiscrollview jvm google-sheets-formula chart.js com subprocess geolocation centos webdriver snowflake-cloud-data-platform html5-canvas garbage-collection widget dialog numbers concatenation sql-update qml set windows-10 tuples mapreduce smtp java-stream ionic2 rotation modal-dialog spring-data android-edittext http-headers nuget doctrine radio-button sonarqube grid lucene xmlhttprequest internationalization listbox initialization switch-statement components google-play apache-camel boolean serial-port ldap ios5 youtube-api return gdb pivot latex eclipse-plugin frameworks tags containers github-actions dataset asp-classic label foreign-keys subquery c++17 copy uinavigationcontroller delegates google-cloud-storage migration struts2 base64 protractor sql-server-2008-r2 find embedded queue uibutton arguments composer-php append jaxb zip stack cucumber autolayout ide entity-framework-6 popup iteration airflow tailwind-css windows-7 r-markdown ssl-certificate vb6 gmail hover jqgrid g++ udp Next You’ll be prompted to create an account to view your personalized homepage. (/) Home (/questions) Questions (/tags) Tags (/beta/discussions) Discussions Labs (https://chat.stackoverflow.com/?tab=all&sort=active) Chat (/users) Users (/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (/collectives-all) Explore all Collectives Teams () Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams-compact) Explore Teams Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. (/collectives) Learn more about Collectives Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. (https://stackoverflow.co/teams/) Learn more about Teams (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (/questions/12806893/use-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory) Use nginx to serve static files from subdirectories of a given directory (/questions/ask) Ask Question (2012-10-09 19:17:20Z) Asked 12 years, 6 months ago Modified (?lastactivity) (2024-06-24 11:03:28Z) 9 months ago (Viewed 280,312 times) Viewed 280k times This question shows research effort; it is useful and clear (70:3:31e,16:474a482b1f24b5f5,10:1743959515,16:bfc64700855b1d6f,8:12806893,6467f52c148feae66e1a650d0f8e58783e87ca16a2ce2f2ad6afd62fd848e8dc) 108 (This question does not show any research effort; it is unclear or not useful) (70:3:31e,16:441aceb06bf56721,10:1743959515,16:f20001fbb144b42f,8:12806893,6139a710224969468b92c08f2b5deb190dd5a81c94810008fc96797beca2a395) Save this question. (/posts/12806893/timeline) Show activity on this post. I have several sets of static .html files on my server, and I would like use nginx to serve them directly. For example, nginx should serve an URI of the following pattern: www.mysite.com/public/doc/foo/bar.html with the .html file that is located at /home/www-data/mysite/public/doc/foo/bar.html . You can think of foo as the set name, and bar as the file name here. I wonder whether the following piece of nginx config would do the job: server { listen 8080; server_name www.mysite.com mysite.com; error_log /home/www-data/logs/nginx_www.error.log; error_page 404 /404.html; location /public/doc/ { autoindex on; alias /home/www-data/mysite/public/doc/; } location = /404.html { alias /home/www-data/mysite/static/html/404.html; } } In other words, all requests of the pattern /public/doc/.../....html are going to be handled by nginx, and if any given URI is not found, a default www.mysite.com/404.html is returned. (/questions/tagged/nginx) (show questions tagged 'nginx') nginx (/questions/tagged/static-files) (show questions tagged 'static-files') static-files (/q/12806893) (Short permalink to this question) Share Share a link to this question Copy link (https://creativecommons.org/licenses/by-sa/3.0/) (The current license for this post: CC BY-SA 3.0) CC BY-SA 3.0 (/posts/12806893/edit) () Improve this question Follow (70:3:31e,16:c9e8de257f70be67,10:1743959515,16:f2d259d37f16e6cd,8:12806893,39b9a0db93d224fa6a7252e981c441f4518a38f4b3f9bb76072cc6d56852311a) Follow this question to receive notifications asked (2012-10-09 19:17:20Z) Oct 9, 2012 at 19:17 (/users/1036544/mlister) (MLister's user avatar) (/users/1036544/mlister) MLister MLister (reputation score 10,340) 10.3k (18 gold badges) 18 18 gold badges (67 silver badges) 67 67 silver badges (93 bronze badges) 93 93 bronze badges (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 3 Answers 3 Sorted by: (/questions/12806893/use-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful (70:3:31e,16:59b73bf4361cfb0a,10:1743959515,16:9fef78f9cac5a4ba,8:12807304,85036650e2a8624d7290d5199acb552084591a56be3b3b20b6f77cf2081e7228) 147 (This answer is not useful) (70:3:31e,16:960bd6f702b9cd4d,10:1743959515,16:2a27a04584ae1917,8:12807304,85c039a9a1213eb229e7f4bfcbc8f98194b7d724808b1f31d4ee3186d8c0c66e) Save this answer. (Loading when this answer was accepted…) (/posts/12807304/timeline) Show activity on this post. It should work, however (http://nginx.org/en/docs/http/ngx_http_core_module.html#alias) http://nginx.org/en/docs/http/ngx_http_core_module.html#alias says: When location matches the last part of the directive’s value: it is better to use the root directive instead: which would yield: server { listen 8080; server_name www.mysite.com mysite.com; error_log /home/www-data/logs/nginx_www.error.log; error_page 404 /404.html; location /public/doc/ { autoindex on; root /home/www-data/mysite; } location = /404.html { root /home/www-data/mysite/static/html; } } (/a/12807304) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/3.0/) (The current license for this post: CC BY-SA 3.0) CC BY-SA 3.0 (/posts/12807304/edit) () Improve this answer Follow (70:3:31e,16:0760c07c28a08312,10:1743959515,16:41d15fcd77f65b12,8:12807304,3b288bd21dc01883a55736cacb9a90e33f356cf41a414063b849014a2701b24d) Follow this answer to receive notifications (/posts/12807304/revisions) (show all edits to this post) edited (2016-02-21 19:15:31Z) Feb 21, 2016 at 19:15 (/users/1869326/dipole-moment) (dipole_moment's user avatar) (/users/1869326/dipole-moment) dipole_moment (reputation score) 5,884 (4 gold badges) 4 4 gold badges (42 silver badges) 42 42 silver badges (56 bronze badges) 56 56 bronze badges answered (2012-10-09 19:43:25Z) Oct 9, 2012 at 19:43 (/users/2049849/cobaco) (cobaco's user avatar) (/users/2049849/cobaco) cobaco cobaco (reputation score 10,566) 10.6k (6 gold badges) 6 6 gold badges (39 silver badges) 39 39 silver badges (33 bronze badges) 33 33 bronze badges 2 (number of 'useful comment' votes received) 1 Using 2 roots gave me problems in the past, what I usually do is use one root and alias for other locations as @AlessioCampanelli suggests – (/users/3090309/camposer) (5,662 reputation) camposer Commented (2020-04-11 11:42:08Z, License: CC BY-SA 4.0) Apr 11, 2020 at 11:42 (this comment was edited 1 time) (number of 'useful comment' votes received) 1 Using root is the right answer. However it does not serve the static pages for me. – (/users/1469755/bsesic) (609 reputation) bsesic Commented (2022-10-12 06:10:00Z, License: CC BY-SA 4.0) Oct 12, 2022 at 6:10 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:c801bb711d9f4b42,10:1743959515,16:74dbbbc942fe9344,8:75765188,74eb2b2d71cb951ffb3755cfbdb7c67b56b4dd647b0dd2ce13667dcbe84cffd5) 8 (This answer is not useful) (70:3:31e,16:8f1ae6b1e9612bea,10:1743959515,16:568fe360bf2a08bb,8:75765188,398a66308cb57b6c13e84c85104d30a40dfaff1a4abb27c5e5fdad0eff4b44e2) Save this answer. (Loading when this answer was accepted…) (/posts/75765188/timeline) Show activity on this post. You can use the following code. You can also use this code to serve vuejs or reactjs static files, Just modifile the alias to point to the root of your file directory; location /files { #autoindex on; alias /files; try_files $uri /index.html =404; } Make sure the access permissions are right too. sudo chown -R 1000 /files Example on how to access the files http://example.com/files/text-file.txt (/a/75765188) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/75765188/edit) () Improve this answer Follow (70:3:31e,16:c17a9d1fc91c0804,10:1743959515,16:f82dc68966783c6a,8:75765188,d9078ebac7ce18113ca6cc743dd579f3c534a20fbf644acd0715988e9000a345) Follow this answer to receive notifications (/posts/75765188/revisions) (show all edits to this post) edited (2023-04-01 11:05:45Z) Apr 1, 2023 at 11:05 answered (2023-03-17 08:18:12Z) Mar 17, 2023 at 8:18 (/users/12123833/jay) (Jay's user avatar) (/users/12123833/jay) Jay Jay (reputation score) 1,062 (3 gold badges) 3 3 gold badges (21 silver badges) 21 21 silver badges (35 bronze badges) 35 35 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:b2106ba1e63aac04,10:1743959515,16:63791edee15f41cc,8:78662019,813a8ec933c11a84b00ed1ea2a2f5e588da9451539b4f1ca3c1aec6641b573d1) 0 (This answer is not useful) (70:3:31e,16:524e57289bb92966,10:1743959515,16:fd7ffe1d3f14932d,8:78662019,b5d95fd54953d7ed2307da09c48586e45a3a3740b4b4deca778b4ccb75d12518) Save this answer. (Loading when this answer was accepted…) (/posts/78662019/timeline) Show activity on this post. if you are using static middleware for example app.use(express.static('assets')); suppose you have an image in yourprojectAddress/assets/media/cat1.jpg and you are using port 3000 for your application so to serve that image this is nginx config location /media/ { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } (/a/78662019) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/78662019/edit) () Improve this answer Follow (70:3:31e,16:3431c32ea81270e2,10:1743959515,16:e31951d70c6c0523,8:78662019,6fa50c193ab3803a683dcbe1b3b82e75cd029d64031d06dee560a3711d342817) Follow this answer to receive notifications answered (2024-06-24 11:03:28Z) Jun 24, 2024 at 11:03 (/users/15446038/mohammad-reza-shabani) (mohammad reza shabani's user avatar) (/users/15446038/mohammad-reza-shabani) mohammad reza shabani mohammad reza shabani (reputation score) 79 (7 bronze badges) 7 7 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) (12806893) (false) () (0) Your Answer (True) Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question . Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our (/help/how-to-answer) tips on writing great answers . Draft saved Draft discarded (59e99b481907aca79504282706e4b1db65c79b5bb11a4cbc1d88997106647265) Sign up or (/users/login?ssrc=question_page&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f12806893%2fuse-nginx-to-serve-static-files-from-subdirectories-of-a-given-directory%23new-answer) log in Sign up using Google Sign up using Email and Password (false) (false) Submit Post as a guest Name () () Email Required, but never shown () () Post as a guest Name () () Email Required, but never shown () () Post Your Answer Discard By clicking “Post Your Answer”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy .(1) Start asking to get answers Find the answer to your question by asking. (/questions/ask) Ask question Explore related questions (/questions/tagged/nginx) (show questions tagged 'nginx') nginx (/questions/tagged/static-files) (show questions tagged 'static-files') static-files See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/04/03/from-training-to-inference-the-new-role-of-web-data-in-llms/?cb=1) From training to inference: The new role of web data in LLMs (https://stackoverflow.blog/2025/04/04/is-ai-a-bubble-or-a-revolution-the-answer-is-yes/?cb=1) Is AI a bubble or a revolution? The answer is yes. Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/407927/changes-to-reporting-for-the-status-review-escalation-process?cb=1) Changes to reporting for the [status-review] escalation process (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned?cb=1) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/433466/a-discussion-about-closed-and-potentially-useful-posts-on-stack-overflow?cb=1) A discussion about closed (and potentially useful) posts on Stack Overflow Linked (https://stackoverflow.com/q/30128086?lq=1) (Question score (upvotes - downvotes)) 5 (https://stackoverflow.com/questions/30128086/serving-static-content-nginx?noredirect=1&lq=1) Serving Static Content NGINX (https://stackoverflow.com/q/30021696?lq=1) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/30021696/using-nginx-to-serve-local-files-instead-of-remote-files?noredirect=1&lq=1) Using nginx to serve local files instead of remote files (https://stackoverflow.com/q/45601524?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/45601524/make-html-code-show-all-pictures-in-a-folder-from-ftp?noredirect=1&lq=1) Make HTML code show all pictures in a folder from FTP? (https://stackoverflow.com/q/62797510?lq=1) (Question score (upvotes - downvotes)) -1 (https://stackoverflow.com/questions/62797510/deploying-react-js-and-node-js-full-stack-on-aws-production?noredirect=1&lq=1) Deploying react js and node js full stack on AWS production? (https://stackoverflow.com/q/56084921?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/56084921/how-to-do-url-rewrite-for-folder-structure?noredirect=1&lq=1) How to do URL rewrite for folder structure (https://stackoverflow.com/q/51213526?lq=1) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/51213526/nginx-rewrite-localhost-to-usr-share-nginx-static?noredirect=1&lq=1) Nginx rewrite localhost to /usr/share/nginx/static (https://stackoverflow.com/q/63767598?lq=1) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/63767598/nginx-how-to-serve-multiple-contents-with-a-single-internal-directive-after-au?noredirect=1&lq=1) Nginx : How to serve multiple contents with a single internal directive after authentication (https://stackoverflow.com/q/68601216?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/68601216/react-play-videos-with-paths-outside-the-public-directory?noredirect=1&lq=1) REACT: Play Videos with paths outside the public directory (https://stackoverflow.com/q/65753645?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/65753645/static-css-image-files-not-being-sent-nginx-express?noredirect=1&lq=1) Static css/image files not being sent (NGINX/Express) Related (https://stackoverflow.com/q/7704491?rq=3) (Question score (upvotes - downvotes)) 5 (https://stackoverflow.com/questions/7704491/nginx-simple-configuration-for-serving-all-the-files-in-a-directory-and-all-th?rq=3) Nginx , SImple configuration for serving all the files in a Directory and all the directories within (https://stackoverflow.com/q/21105973?rq=3) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/21105973/nginx-serving-static-files-by-url-path?rq=3) Nginx: serving static files by URL path (https://stackoverflow.com/q/25448590?rq=3) (Question score (upvotes - downvotes)) 5 (https://stackoverflow.com/questions/25448590/configuring-nginx-to-serve-static-files-from-a-custom-directory?rq=3) configuring nginx to serve static files from a custom directory (https://stackoverflow.com/q/29084158?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/29084158/how-to-serve-specific-static-files-with-nginx?rq=3) How to serve specific static files with nginx? (https://stackoverflow.com/q/33989060?rq=3) (Question score (upvotes - downvotes)) 20 (https://stackoverflow.com/questions/33989060/how-to-serve-a-directory-of-static-files-at-a-certain-location-path-with-nginx?rq=3) How to serve a directory of static files at a certain location path with nginx? (https://stackoverflow.com/q/34801512?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/34801512/nginx-serving-static-files-from-multiple-locations-probably-very-easy-to-solve?rq=3) Nginx: serving static files from multiple locations (probably very easy to solve) (https://stackoverflow.com/q/40976266?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/40976266/nginx-serving-static-files?rq=3) NGINX serving static files (https://stackoverflow.com/q/50714859?rq=3) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/50714859/using-nginx-to-serve-a-static-files-in-a-subdirectory?rq=3) Using Nginx to serve a static files in a subdirectory (https://stackoverflow.com/q/68738646?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/68738646/nginx-deploy-static-file-in-dynamic-sub-folder?rq=3) Nginx deploy static file in dynamic sub folder (https://stackoverflow.com/q/68965115?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/68965115/nginx-serve-static-files-for-a-subpath?rq=3) Nginx: Serve static files for a subpath (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Economics Stack Exchange) (https://economics.stackexchange.com/questions/60216/doesnt-a-negative-compensating-variation-cv-mean-the-change-is-good-while-po) Doesn't a negative compensating variation (CV) mean the change is good (while positive means it's bad)? (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/123957/what-is-the-point-of-knowing-whether-we-are-in-a-simulation-or-not) What is the point of knowing whether we are in a simulation or not? (MathOverflow) (https://mathoverflow.net/questions/490492/history-of-invariant-types-in-model-theory) History of invariant types in model theory (Stack Overflow) (https://stackoverflow.com/questions/79553314/why-does-kr-say-that-pointers-are-preferable-to-arrays-as-function-parameters) Why does K&R say that pointers are preferable to arrays as function parameters? (Movies & TV Stack Exchange) (https://movies.stackexchange.com/questions/125014/why-is-the-movie-titled-the-brutalist) Why is the movie titled "The Brutalist"? (Theoretical Computer Science Stack Exchange) (https://cstheory.stackexchange.com/questions/55258/counting-complexity-of-sat-with-2-occurrences) Counting complexity of SAT with 2 occurrences (Cross Validated) (https://stats.stackexchange.com/questions/663525/invertibility-of-dispersion-matrix-and-the-rank-of-centering-matrix) Invertibility of dispersion matrix and the rank of centering matrix (Code Review Stack Exchange) (https://codereview.stackexchange.com/questions/295826/julias-set-fractal-timelapse) Julias Set fractal timelapse (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/131286/an-excellent-description) An excellent description (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/740359/what-is-causing-this-extra-line-spacing) What is causing this extra line spacing? (Cross Validated) (https://stats.stackexchange.com/questions/663539/analysing-a-monotonic-relationship-that-isnt-uniform-across-the-whole-range-of) Analysing a monotonic relationship that isn't uniform across the whole range of data - Pearson & Kendall's Tau not suitable (Movies & TV Stack Exchange) (https://movies.stackexchange.com/questions/125017/what-language-is-captain-america-speaking-when-talking-to-batroc-in-winter-soldi) What language is Captain America speaking when talking to Batroc in Winter Soldier? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/740354/how-to-name-a-bfseries-type-macro-according-to-latex3-convention) How to name a `\bfseries`-type macro according to LaTeX3 convention? (Buddhism Stack Exchange) (https://buddhism.stackexchange.com/questions/52174/why-no-inclusion-of-anusaya-asava-in-dependent-origination) Why no inclusion of anusaya/ asava in dependent origination? (German Language Stack Exchange) (https://german.stackexchange.com/questions/79047/extending-a-dative-case-phrase) Extending a dative case phrase (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/312023/unwanted-vector-in-vectorplot) Unwanted vector in VectorPlot (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/740339/multiple-delimiters-for-a-macro) Multiple delimiters for a macro (Politics Stack Exchange) (https://politics.stackexchange.com/questions/91277/what-are-the-advantages-for-the-us-in-starting-a-trade-war-with-everyone-else-at) What are the advantages for the US in starting a trade war with everyone else at the same time? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/740366/vertical-alignment-not-proper-in-sections-number-in-the-left-margin) Vertical alignment not proper in sections number in the left margin (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/743185/kicad-added-footprints-only-addable-in-pcb-editor) KiCad added footprints only addable in PCB Editor (Academia Stack Exchange) (https://academia.stackexchange.com/questions/217773/my-former-university-is-trying-to-have-its-name-removed-from-my-papers-probably) My former university is trying to have its name removed from my papers (probably as revenge for whistleblowing). How to proceed? (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/265751/is-it-possible-the-homo-genus-could-evolve-if-magically-all-of-earths-fossil) Is it possible the homo genus could evolve if, magically, all of earth's fossil fuels had been burned within a 1000 year span? (Christianity Stack Exchange) (https://christianity.stackexchange.com/questions/105767/how-does-calvinism-explain-paul-and-silas-response-to-the-philippian-jailer-and) How does Calvinism explain Paul and Silas' response to the Philippian jailer and the "persuading" of men? (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/316624/connected-two-dishwashers-to-a-single-garbage-disposal) Connected two dishwashers to a single garbage disposal (/feeds/question/12806893) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/12806893) () (https://stackoverflow.com) (https://stackoverflow.com) Stack Overflow (/questions) Questions (/help) Help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (/contact) Contact Us Your Privacy Choices (https://stackoverflow.com/legal/cookie-policy) Cookie Policy (https://stackexchange.com) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.4.4.24803