Enable CORS in Nginx

Enable CORS in Nginx

To enable CORS in nginx, add following inside web sites sevrer config. add_header ‘Access-Control-Allow-Origin’ ‘*’; add_header ‘Access-Control-Allow-Credentials’ ‘true’; add_header ‘Access-Control-Allow-Methods’

List installed Modules in Nginx

List installed Modules in Nginx

To list modules compiled with nginx, you can run nginx -V nginx -V This print nginx version along with configuration

Nginx remove html from url

Nginx remove html from url

If you have a static website build using plain html files, your url will look like https://yourdomain/page.html. This .html extension

Nginx show full url in access log

Nginx show full url in access log

To show the full URL in the nginx access log, add the following If you are behind a reverse proxy,

Nginx Web Server

Nginx HTTP 414 request-URI too large

On a Nginx server, when accessing a long url, i get error HTTP 414 Request-URI Too Large To fix the

Nginx Web Server

Show Real IP Nginx Behind Reverse Proxy

When your Nginx web server is running behind a reverse proxy, you will see IP of the reverse proxy server

Nginx Location Directive

Nginx Location Directive

Nginx Location Directive is used to route request to correct files. Match Exact match is used to match an exact

nginx password protect

Nginx Password Protect a website

To password protect a website, you need to install htpasswd utility. On Ubuntu/Debian, you can install it with the command

Configure Nginx to listen on single IP Address

Configure Nginx to listen on single IP Address

By default Nginx listens on all IP address on a server. To make nginx listen on specific IP address, edit

Nginx Web Server

Nginx Config for Laravel Application in sub folder

To run Laravel Application on a subfolder of a website, use the following configuration. If you run the Laravel application

Nginx Config for Laravel Application

Nginx Config for Laravel Application

Here is Nginx configuration for a laravel application server { listen 80; server_name www.domain.com; access_log /var/log/nginx/domain.com.log; root /home/domain.com/html/public; index index.html

nmap

Disable TLSv1 in Nginx

To disable TLSv1 in nginx, add ssl_protocols TLSv1.1 TLSv1.2; in your server config. if you are using letsencrypt SSL, edit