Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Nginx + php-fpm


Recommended Posts

Добрый гдень!

Переношу сайт с апача на nginx + php-fpm


Может кто нибудь погделиться хорошим конфигом?

Заранее спасипотому что!

  • +1 1
Link to comment
Share on other sites


server {
	server_name site.ru www.site.ru;
	listen 00.00.00.00:80;
	return 301 https://site.ru$request_uri;
}

server {
	server_name www.site.ru;
	listen 00.00.00.00:443 ssl http2;
	ssl on;
	ssl_certificate "/var/www/httpd-cert/www-root/site.ru_le1.crtca";
	ssl_certificate_key "/var/www/httpd-cert/www-root/site.ru_le1.key";
	ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
	ssl_prefer_server_ciphers on;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	add_header Strict-Transport-Security "max-age=31536000;";
	ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
	return 301 https://site.ru$request_uri;
}

server {
	server_name site.ru;
	listen 00.00.00.00:443 ssl http2;
	ssl on;
	ssl_certificate "/var/www/httpd-cert/www-root/site.ru_le1.crtca";
	ssl_certificate_key "/var/www/httpd-cert/www-root/site.ru_le1.key";
	ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
	ssl_prefer_server_ciphers on;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	add_header Strict-Transport-Security "max-age=31536000;";
	ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
	
	charset UTF-8;
	index index.php index.html;
	disable_symlinks if_not_owner from=$root_path;
	
	include /etc/nginx/vhosts-includes/*.conf;
	include /etc/nginx/vhosts-resources/site.ru/*.conf;
	
	access_log /var/www/httpd-logs/site.ru.access.log;
	error_log /var/www/httpd-logs/site.ru.error.log notice;

	set $root_path /var/www/www-root/data/www/site.ru;
	root $root_path;
	
	location /admin {
        index index.php;
    }
	
	location / {
        try_files $uri $uri/ @opencart;
    }
    
    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }
    
     location /index.html {
        rewrite ^(.*)$ https://site.ru/ permanent;
    } 
    
	location ~* ^.+\.(jpg|jpeg|gif|png|svg|svgz|eot|otf|woff|ttf|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
		expires max;
		etag on;
		log_not_found off;
	}
	
    location ~* (\.(tpl|ini))$ {
        deny all;
    }
    
    location ~ (?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt)) {
        deny all;
    }
    
    location ~ [^/]\.php(/|$) {
		fastcgi_index index.php;
		fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
		fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
		try_files $uri =404;
		include fastcgi_params;
	}
}

 

ip подсивляете свой

 

 

  • +1 2
Link to comment
Share on other sites


1 hour ago, zlob said:
server {
	server_name site.ru www.site.ru;
	listen 00.00.00.00:80;
	return 301 https://site.ru$request_uri;
}
...............
}

 

ip подсивляете свой

 

 

спасипотому что!

а есть настройки для fastcgi?

Edited by zfgad
Link to comment
Share on other sites


  • 1 year later...
  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.