Skip to content

Instantly share code, notes, and snippets.

View sashas777's full-sized avatar
🌟
Per Aspera Ad Astra!

Alexander Lukyanov sashas777

🌟
Per Aspera Ad Astra!
View GitHub Profile
@sashas777
sashas777 / m2
Created July 8, 2019 16:07
M2 Virtual Host
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 July 8, 2019 16:07
M2 Virtual Host
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 July 8, 2019 16:05
/etc/nginx/sashas-config/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 July 8, 2019 16:02
/etc/nginx/sashas-config/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 July 19, 2018 23:51
Magento 2 Cloud Multistore where store set by url /{{store_code}}
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 March 4, 2017 06:05
X-Sendfile Apache
#
# X-Sendfile
#
LoadModule xsendfile_module modules/mod_xsendfile.so
XSendFile On
XSendFilePath "/var/www/site/"
@sashas777
sashas777 / registration.php
Created January 24, 2017 04:57
Magento 2.1.3 Make Customer Attribute - registration.php
<?php
/**
* @author Sashas IT Support <[email protected]>
* @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 February 5, 2017 02:23
Magento 2.1.3 Make Customer Attribute - InstallData.php
<?php
/**
* @author Sashas IT Support <[email protected]>
* @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 January 24, 2017 04:56
Magento 2.1.3 Make Customer Attribute - module.xml
<?xml version="1.0"?>
<!--
~ @author Sashas IT Support <[email protected]>
~ @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 July 8, 2019 16:14
Magento 2 Admin 404 Not Found Issue
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;