I am using Nginx server and with that, I am using an angular application. The application is running fine but in the console, I got the following error
Error with Permissions-Policy header: Parse of permissions policy failed because of errors reported by structured header parser
To solve this error I added following code in my nginx configuration.
Nginx web server is becoming most popular in these year. Best server response time and minimum execution time is the advantages of Nginx server. wordpress.com itself using the nginx server for hosting these sites and blogs.
How to remove www from URL with nginx server
How to remove www from URL with nginx server
Many people want to remove the www from URL. I will tell you the tip how to remove the www from URL with nginx server.
Open your Ngnix configuration file (nginx.conf). Just use following code in server block.
if ($host ~* ^www\.(.*)) {
set $remove_www $1;
rewrite ^(.*)$ http://$remove_www$1 permanent;
}
Nginx is becoming very popular to host the websites. WordPress is best and popular CMS in the world now. Nginx gives really great performance with wordpress sites. Earlier I given the Nginx configuration with this code. I given code for wordpress and Nginx configuration. For hosting your wordpress website on Nginx server is the best option.
nginx wordpress plugins nginx setup for wordpress
If you have dedicated server then go with nginx server.
wordpress + Nginx + permalink
I found two plugins which are supported to Nginx installtion. But both plugins are not give you nginx rule for setup nginx rule.
I solved the issue with Wordprss and Images. If you want to host or install two instances on one domain in that senorio you can use following code. we given code for Nginx rule with image fix for multiple wordpress instance. you should use our code for fixing
Nginx rule with image fix for multiple wordpress instance
Please Use the following code;
location ~ ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
#images for wordpress instance one
if ($request_uri ~* /wordpress) {
set $set_root /usr/share/nginx/html/wordpress1;
}
#images for wordpress instance two
if ($request_uri ~* /moms) {
set $set_root /usr/share/nginx/html/wordpress2;
}
Nginx famous now. We given information for how to host multiple rails site on Nginx. we given the configuration code along with their detailed information.
How to host multiple rails site on Nginx
User following code in Nginx.conf file.. and paste into that file.
#vim /etc/nginx/nginx.conf
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log main;
sendfile on;
upstream mongrel_cluster_example1 {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
upstream mongrel_cluster_example2 {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name example1.com example2.net;
client_max_body_size 120M;
set $myroot /var/www/html;
if ($host ~* example1\.com$) {
set $myroot /home/example1/public;
}
if ($host ~* example2\.net$) {
set $myroot /home/example2/public;
}
root $myroot;
location ~* ^/(images|stylesheets|javascripts).+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root $myroot;
}
location / {
if ($host ~* example1\.com$) {
proxy_pass http://mongrel_cluster_example1;
} #if check for domain qa.teenangel ends here
if ($host ~* example2\.net$) {
root /home/rail_project/myproject/public;
proxy_pass http://mongrel_cluster_example2;
} #if check for domain ends here
}
}
}
The hosts file is a computer file used by an operating system to map hostnames to IP addresses.
On many operating systems, the host file content is used preferentially over other methods,
such as the Domain Name System (DNS). Unlike DNS, the hosts file is under the control of the local computer’s administrator
Locate the file “Hosts” on your computer:
Windows
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
Linux
/etc/hosts or /etc/host.conf or /etc/nsswitch.conf
Symbian
C:\system\data\hosts
Mac OS
/private/etc/hosts or /etc/hosts
In that file you can edit entry like this
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost localhost yourlocaldomain.com , example.com
::1 localhost6.localdomain6 localhost6
192.168.2.200 intranet
Maybe you aware with apache “mod_gzip and mod deflate”
Compress the server response with Nginx
Web page compression is not a new technology, but it has recently gained higher recognition in the minds of IT administrators and managers because of the rapid ROI it generates. Compression extensions exist for most of the major Web server platforms
For Apache Normally use following syntax:
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude mime ^text/css$