Skip to content

Instantly share code, notes, and snippets.

Alexander Lukyanov sashas777

Block or report user

Report or block sashas777

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sashas777
sashas777 / m2
Created Jul 8, 2019
M2 Virtual Host
View m2
server {
listen 8080;
server_name local.something.com;
set $MAGE_ROOT /usr/share/nginx/html/something;
set $MAGE_RUN_TYPE website;
include /usr/share/nginx/html/something/nginx.conf.sample;
}
@sashas777
sashas777 / m2
Created Jul 8, 2019
M2 Virtual Host
View m2
server {
listen 8080;
server_name local.something.com;
set $MAGE_ROOT /usr/share/nginx/html/something;
set $MAGE_RUN_TYPE website;
include /usr/share/nginx/html/something/nginx.conf.sample;
}
@sashas777
sashas777 / https
Created Jul 8, 2019
/etc/nginx/sashas-config/https
View https
server {
listen 443 ssl http2;
server_name admin.local.xx.com;
ssl on;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_session_timeout 24h;
keepalive_timeout 600s;
@sashas777
sashas777 / mapping
Created Jul 8, 2019
/etc/nginx/sashas-config/mapping
View mapping
map $http_host $MAGE_RUN_CODE {
admin.local.x.com admin;
local.a.com websiteA;
local.b.ca websiteB;
default admin;
}
@sashas777
sashas777 / gist:ee1d771f7c5c9c0d8477bb232a1c54da
Created Jul 19, 2018
Magento 2 Cloud Multistore where store set by url /{{store_code}}
View gist:ee1d771f7c5c9c0d8477bb232a1c54da
Two steps:
1. Setup Multistore at the admin where each store url are the same
2. Create pub/{{store_code}}/index.php
<?php
require realpath(__DIR__) . '/../../app/bootstrap.php';
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = '{{store_code}}';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
@sashas777
sashas777 / httpd.conf
Created Mar 4, 2017
X-Sendfile Apache
View httpd.conf
#
# X-Sendfile
#
LoadModule xsendfile_module modules/mod_xsendfile.so
XSendFile On
XSendFilePath "/var/www/site/"
@sashas777
sashas777 / registration.php
Created Jan 24, 2017
Magento 2.1.3 Make Customer Attribute - registration.php
View registration.php
<?php
/**
* @author Sashas IT Support <support@sashas.org>
* @copyright 2017 Sashas IT Support Inc. (http://www.extensions.sashas.org)
* @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Sashas_CustomerAttribute',
@sashas777
sashas777 / InstallData.php
Last active Feb 5, 2017
Magento 2.1.3 Make Customer Attribute - InstallData.php
View InstallData.php
<?php
/**
* @author Sashas IT Support <support@sashas.org>
* @copyright 2017 Sashas IT Support Inc. (http://www.extensions.sashas.org)
* @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
*/
namespace Sashas\CustomerAttribute\Setup;
@sashas777
sashas777 / module.xml
Created Jan 24, 2017
Magento 2.1.3 Make Customer Attribute - module.xml
View module.xml
<?xml version="1.0"?>
<!--
~ @author Sashas IT Support <support@sashas.org>
~ @copyright 2017 Sashas IT Support Inc. (http://www.extensions.sashas.org)
~ @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Sashas_CustomerAttribute" setup_version="2.0.0">
<sequence>
<module name="Customer"/>
@sashas777
sashas777 / fix.sql
Last active Jul 8, 2019
Magento 2 Admin 404 Not Found Issue
View fix.sql
SET FOREIGN_KEY_CHECKS=0;
UPDATE store SET store_id = 0 WHERE code='admin';
UPDATE store_group SET group_id = 0 WHERE name='Default';
UPDATE store_website SET website_id = 0 WHERE code='admin';
UPDATE customer_group SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;
You can’t perform that action at this time.