Posts

Showing posts with the label nginx

How to redirect to a different domain using NGINX?

server { server_name .mydomain.com; return 301 http://www.adifferentdomain.com$request_uri; }

Nginx CORS error

Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers add these lines in server part of the config file    add_header 'Access-Control-Allow-Origin' * always;         add_header 'Access-Control-Allow-Headers' * ; xmlhttprequest-ajax-set-content-type  location ~* \.(?:ico|css|js|gif|jpe?g|png|woff|application/json)$ {             try_files $uri @blogcssjs;             expires 30d;             add_header 'Access-Control-Allow-Origin' * always;             add_header Pragma public;             add_header Cache-Control "public";         }

nginx access denied

access denied After searching , I found it.It's all deals with SELINUX which is a security feature disable selinux completely and reboot machine

404 nginx error

Change the line in the location block to: try_files $uri $uri/ /index.php?q=$uri&$args; and reload nginx sudo systemctl reload nginx All should be well :) if reactjs location ~ [^/]\.php(/|$) {             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;             if (!-f $document_root$fastcgi_script_name) {                 return  404;             } }

Nginx and PHP-FPM Configuration and Optimizing

Nginx Configuration and Optimizing Tips and Tricks Nginx Tip 1. – Organize Nginx Configuration Files Normally Nginx configuration files are located under  /etc/nginx  path. One good way to organize configuration files is use Debian/Ubuntu Apache style setup: ## Main configuration file ## /etc/nginx/nginx.conf ## Virtualhost configuration files on ## /etc/nginx/sites-available/ /etc/nginx/sites-enabled/ ## Other config files on (if needed) ## /etc/nginx/conf.d/ Virtualhost files have 2 paths, because  sites-available  directory can contain any stuff, like test configs, just copied/created configs, old configs and so on. And  sites-enabled  contains only really enabled configurations, actually  just only symbolic links  to sites-available directory. Remember add following includes at the end of your  nginx.conf  file: ## Load virtual host conf files. ## include /etc/nginx/sites-enabled/* ; ## Load another configs from...