Posts

Showing posts with the label config

Nginx error says "upstream sent too big header while reading response header from upstream"

My PHP web server with Nginx as reverse proxy says "upstream sent too big header while reading response header from upstream" And, here is how to fix it: 1. Edit the nginx configuration for my site, for example, /etc/nginx/sites-available/mysite $ sudo nano /etc/nginx/sites-available/mysite Modify these lines ...         location ~ \.php$ {                 include snippets/fastcgi-php.conf;                 fastcgi_pass unix:/run/php/php7.0-fpm.sock;                 fastcgi_buffer_size 128k;                 fastcgi_buffers 4 256k;                 fastcgi_busy_buffers_size 256k;         } ... 2. Restart nginx and enjoy $ sudo systemctl restart nginx

How to fix "Index column size too large" error when doing keystone db_sync

I was trying to deploy the keystone service manually on my Ubuntu 16.04 desktop: # su -s /bin/sh -c "keystone-manage db_sync" keystone and couldn't make it work. I got this error: DBError: (pymysql.err.InternalError) (1709, u'Index column size too large. The maximum column size is 767  bytes.') [SQL: u'\nCREATE TABLE migrate_version (\n\trepository_id VARCHAR(250) NOT NULL, \n\trepository_path TEXT, \n\tversion INTEGER, \n\tPRIMARY KE Y (repository_id)\n)\n\n'] (Background on this error at: http://sqlalche.me/e/2j85) Then I figured out that the new release of mariadb/mysql  (10.0.33-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04) uses utf8mb4 as the character encoding which uses more bytes per character than utf8. And the length used for the column or key repository_id is 250 VARCHAR and 4 bytes per character makes it longer than the limit allowed by InnoDB, which is 767. So to fix it follow these steps: 1. Change character-set-server and collation-s...

How to hide the "Manage databases" link from the Odoo's login link

There is one dangerous setting in Odoo that beginners like me hardly notice: the "Manage databases" link on the login link. Follow that link you will be able to know the database name, create new databases, destroy the current one etc... Even though it may require a master password for all the operations, exposing those functionalities to the public is quite dangerous. Here is how you can hide that link: 1. Edit the odoo's setting: sudo nano /etc/odoo/odoo.conf 2. Modify this line as follows: ... list_db = False ... 3. Save and restart odoo sudo systemctl restart odoo Notes: For those who run odoo in docker, follow these steps instead: 1. Copy the odoo's setting file to the host machine: docker cp 05829b85c385:/etc/odoo/odoo.conf . 2. Edit the file like above 3. Copy the setting file back to the odoo docker instance: docker cp odoo.conf 05829b85c385:/etc/odoo/odoo.conf 4. Restart docker instances (including Postgres instance) sudo...

Get user by username (or any other attributes) in Moodle

You can do as the following snippet to get the user object by username (or any other attributes) #!/usr/bin/php <?php define('CLI_SCRIPT', true); require_once('../config.php'); global $DB; $user = $DB->get_record('user', array('username'=>'myusername'));                                                              print_r($user); exit; ?> Reference:   https://docs.moodle.org/dev/Data_manipulation_API

How to set course format for multiple courses in Moodle

It's pretty cool using MOOSH command line tool of Moodle. You can set course format to topics for multiple cources in Moodle by running this command: moosh course-config-set category 7 format topics Just awesome!!! Reference: http://moosh-online.com/commands/

Show invisible characters in Atom editor except EOL and CR

In Atom editor to show invisible characters (tab, space) except the EOL and CR: >> Edit >> Open Your Config add the following: "*":   editor:     invisibles:         'cr': ''         'eol': ''         'space': '·'         'tab': '⇥'     showIndentGuide: true     showInvisibles: true ... Save and enjoy!

Hide a particular user from the Lightdm login screen in Ubuntu 14.04

In Ubuntu 14.04, to hide a particular user from the LightDM login screen is a little bit tricky because of this bug since 2011: https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/857651 Here is a workaround: 1. Open /etc/lightdm/users.conf: $ sudo nan /etc/lightdm/users.conf 2. Add the user you want to hide to this line (let's call it trinh): hidden-users=nobody nobody4 noaccess trinh 3. Change the uid of that user to under 500: $ sudo usermod -u 499 trinh 4. Reboot

Fix git's "The remote end hung up unexpectedly" error

If you push your changes to a remote branch and get this error: error: RPC failed; result=22, HTTP code = 411 fatal: The remote end hung up unexpectedly Writing objects: 100% (460/460), 1.08 MiB | 0 bytes/s, done. Total 460 (delta 33), reused 0 (delta 0) fatal: The remote end hung up unexpectedly Just increase your git buffer (e.g 500MB) and it will be fine: $ git config http.postBuffer 524288000

Command line scripts must define CLI_SCRIPT before requiring config.php error when accessing moodle

I was trying to run a php command line script inside moodle directory and got this error: ~# php myscript.php Command line scripts must define CLI_SCRIPT before requiring config.php error when accessing moodle To get rid of that error, put this line above config.php include code: define('CLI_SCRIPT', true); require_once(dirname(__FILE__) . '/../config.php'); Reference: https://moodle.org/mod/forum/discuss.php?d=183170

edX-platform - Change site name used in account activation email

The default configuration for SITE_NAME used in account activation email of edx-platform can be change by modify the following file: # nano /edx/app/edxapp/lms.env.json ... "SITE_NAME": "your.custom.domain", ... Restart the LMS/CMS service: # /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp: # /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp_worker:

Fix error: Geany tried to access the Unix Domain socket of another instance...

If you open geany and get this error: "Geany tried to access the Unix Domain socket of another instance running as another user. This is a fatal error and Geany will now quit." Try this solution: In your home directory go to  .config/geany  and delete the  geany_socket  file and try again.