How to output variable in nginx log for debugging

You can send nginx variable values via headers. Handy for development. add_header X-uri “$uri”; and you’ll see in your browser’s response headers: X-uri:/index.php I sometimes do this during local development. It’s also handy for telling you if a subsection is getting executed or not. Just sprinkle it inside your clauses to see if they’re getting … Read more

Nginx enable site command

If you have installed the nginx package from the Ubuntu repositories, you will have two directories. /etc/nginx/sites-enabled and /etc/nginx/sites-available. In the main nginx configuration, /etc/nginx/nginx.conf, you have the following line: include /etc/nginx/sites-enabled/*.conf; So basically to list all available virtualhosts, you can run the following command: ls /etc/nginx/sites-available To activate one of them, run the following … Read more

Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)?

The sites-* folders are managed by nginx_ensite and nginx_dissite. For Apache httpd users who find this with a search, the equivalents is a2ensite/a2dissite. The sites-available folder is for storing all of your vhost configurations, whether or not they’re currently enabled. The sites-enabled folder contains symlinks to files in the sites-available folder. This allows you to … Read more

How do you restart php-fpm?

Note: prepend sudo if not root Using SysV Init scripts directly: /etc/init.d/php-fpm restart # typical /etc/init.d/php5-fpm restart # debian-style /etc/init.d/php7.0-fpm restart # debian-style PHP 7 Using service wrapper script service php-fpm restart # typical service php5-fpm restart # debian-style service php7.0-fpm restart # debian-style PHP 7 Using Upstart (e.g. ubuntu): restart php7.0-fpm # typical (ubuntu … Read more

Nginx config reload without downtime

Run service nginx reload or /etc/init.d/nginx reload It will do a hot reload of the configuration without downtime. If you have pending requests, then there will be lingering nginx processes that will handle those connections before it dies, so it’s an extremely graceful way to reload configs. Sometimes you may want to prepend with sudo

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)