Categories
blog ecommerce magento Nginx

magento 2 permission 2018

sudo chown -R rawi:www-data Magento-CE-2
find /var/www/html/magento/Magento-CE-2 -type f -print0 | xargs -r0 chmod 640
find /var/www/html/magento/Magento-CE-2 -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/html/magento/Magento-CE-2/app/etc
chmod -R g+w /var/www/html/magento/Magento-CE-2/var
chmod -R g+w /var/www/html/magento/Magento-CE-2/generated
chmod -R g+w /var/www/html/magento/Magento-CE-2/vendor
chmod -R g+w /var/www/html/magento/Magento-CE-2/pub
Categories
blog conf Meteor Nginx

nginx conf meteor

# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80;
server_name classified.officialstupid.com;

location = /favicon.ico {

access_log off;
}

# pass requests to Meteor
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; #for websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}

Categories
blog cms multisite Nginx wordpress

wordpress multisite too many server redirects nginx conf

too many server redirects.
 
#wordpress #multisite #wordpressmultisite .conf #nginx #bookmark
 
server {
server_name example.com *.example.com ;
 
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
 
root /var/www/example.com/htdocs;
index index.php;
 
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
 
location / {
try_files $uri $uri/ /index.php?$args ;
}
 
location ~ \.php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
 
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
 
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
}
Categories
blog Linux Nginx SSH ubuntu

nginx shutdown terminal ssh

sudo shutdown -h now
Categories
blog Nginx

nginx 80 port restart

sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart
Categories
blog Let's Encrypt Nginx SSH SSL ubuntu

Quick Secure Nginx with Let’s Encrypt on Ubuntu 14.04

cd /opt/letsencrypt
./letsencrypt-auto certonly -a webroot --webroot-path=/usr/share/nginx/html -d example.com -d www.example.com
sudo ls -l /etc/letsencrypt/live/your_domain_name
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf

Set Up Auto Renewal

/opt/letsencrypt/letsencrypt-auto renew
Categories
blog cloudflare digitalocean Nginx

whitelisting cloudflare in nginx digitalocean

Create /etc/nginx/cloudflare-allow.conf

# https://www.cloudflare.com/ips
# IPv4
allow 199.27.128.0/21;
allow 173.245.48.0/20;
allow 103.21.244.0/22;
allow 103.22.200.0/22;
allow 103.31.4.0/22;
allow 141.101.64.0/18;
allow 108.162.192.0/18;
allow 190.93.240.0/20;
allow 188.114.96.0/20;
allow 197.234.240.0/22;
allow 198.41.128.0/17;
allow 162.158.0.0/15;

# IPv6
allow 2400:cb00::/32;
allow 2606:4700::/32;
allow 2803:f800::/32;
allow 2405:b500::/32;
allow 2405:8100::/32;

Then in your /etc/nginx/sites-available/site.com add:

server {
  listen 80; ## listen for ipv4; this line is default and implied
  listen [::]:80 default ipv6only=on; ## listen for ipv6

  include /etc/nginx/cloudflare-allow.conf;
  deny all;

  server_name direct.site.com www.site.com site.com;

  #...the rest of your config here...
}
Categories
blog Linux Nginx ubuntu

Ubuntu php5-fpm unknown instance

sudo pkill php5-fpm; sudo service php5-fpm start
Categories
blog Nginx

Increase file upload size limit in PHP-Nginx

Changes in php.ini

To change max file upload size to 100MB

Edit…

vim /etc/php5/fpm/php.ini

Set…

upload_max_filesize = 100M
post_max_size = 100M

Change in Nginx config

Add following line to http{..} block in nginx config: /etc/nginx/nginx.conf

http {
	#...
        client_max_body_size 100m;
	#...
}

Reload PHP-FPM & Nginx

service php5-fpm reload
service nginx reload