JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

Configure serving static content with Nginx


You can find Nginx configurations on nginx.conf file.

# Default locaction in mac if you have installed it through homebrew:

	/usr/local/etc/nginx/nginx.conf

# Possible locations on Unix or Linux

	/etc/nginx/nginx.conf
	/opt/nginx/conf/

Open the configuration file: nginx.conf and locate server block under http block.

server {
    listen       80;
    server_name  java2novice.com www.java2novice.com;
    access_log   logs/java2novice.access.log  main;

    # serve static files as per the below configuration. The static file will be cached for 5 days
    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
      root    /var/www/java2novice/htdocs;
      expires 5d;
    }

    # pass requests for dynamic content to rails/turbogears/zope, etc 
    location / {
      proxy_pass      http://127.0.0.1:8080;
    }
  }

Now save the configuration and restart Nginx.

$ sudo nginx -s stop
$ sudo nginx
<< Previous Program | Next Program >>

Nginx Basic Configurations

  1. How to install Nginx on Mac OS?
  2. How to start / stop Nginx?
  3. How to change Nginx default port?
  4. How to change default web location path in Nginx?
  5. Configure serving static content with Nginx
  6. How to configure error logs with Nginx?
Knowledge Centre
Different types of Access Modifiers
public: Any thing declared as public can be accessed from anywhere.

private: Any thing declared as private can't be seen outside of its class.

protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages.

default modifier: Can be accessed only to classes in the same package.
Famous Quotations
It is easier to fight for one’s principles than to live up to them.
-- Alfred Adler

About Author

I'm Nataraja Gootooru, programmer by profession and passionate about technologies. All examples given here are as simple as possible to help beginners. The source code is compiled and tested in my dev environment.

If you come across any mistakes or bugs, please email me to [email protected].

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java™ Platform Standard Ed. 8 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2022 by Nataraja Gootooru. All Rights Reserved.