Enabling MySQL External Connections

You want to do the following to your DB server.

$ /opt/bitnami/mysql/bin/mysql -u root -p -e "grant all privileges on *.* to 'root'@'%' identified by 'your_root_password' with grant option";
$ sudo nano /opt/bitnami/mysql/my.cnf

Remove bind-address = 127.0.0.1


azure vm ssh slow to connect

Goto:

$ sudo nano /etc/ssh/sshd_config

Include:

UseDNS no

Reboot the VM.


WordPress subscriber private pages

By default subscribers can’t see private pages.

add_cap lets us change that.

functions.php

 $subRole = get_role( 'subscriber' );
 $subRole->add_cap( 'read_private_pages' );

Also let’s not dump the WP dashboard on those subscribers :D

function loginRedirect( $redirect_to, $request_redirect_to, $user ) {
    if ( is_a( $user, 'WP_User' ) && $user->has_cap( 'edit_posts' ) === false ) {
        return get_bloginfo( 'siteurl' );
    }
    return $redirect_to;
}
add_filter( 'login_redirect', 'loginRedirect', 10, 3 );

Thank you sltaylor.


phpinfo in the shell

php -i

bitnami LAMP – why is mod_rewrite not working

Yes it is enabled by default but make sure your framework or app httpd-app.conf has AllowOverride set to All.

<directory "..."> 
 ... 
 AllowOverride All 
 ... 
</directory>

For Codeigniter, make sure your .htaccess is in the same dir as your root index.php.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

git clone on remote server (bitnami)

1. Find the .ssh directory
-make sure always use absolute

$ cd /home/bitnami/.ssh

 

2. Generate public and private keys on the server

ssh-keygen

 

3. Copy the public key to your repo settings (bitbucket/github)

$ cat id_rsa.pub

 

4. Try and clone the repo into the server!

$ git clone git@bitbucket.org:username/project-name.git

If your getting permission denied, make sure you have write permission to the folder.


self assigned SSL

How to create a ssl certificate on apache for ubuntu.

sudo openssl req -x509 -nodes -days 999 -newkey rsa:2048 -keyout server.key -out server.crt

httpd-vhosts.conf

<VirtualHost *:80>
  ServerName prs-api0.cloudapp.net
  ServerAlias www.prs-api0.cloudapp.net
  DocumentRoot "/opt/bitnami/apps/{myapp}/htdocs/"
  Include "/opt/bitnami/frameworks/photo/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:443>
  ServerName codeigniter.example.com
  ServerAlias www.codeigniter.example.com
  DocumentRoot "/opt/bitnami/apps/{myapp}/htdocs/"

  SSLEngine on
  SSLCertificateFile "/opt/bitnami/frameworks/codeigniter/conf/certs/server.crt"
  SSLCertificateKeyFile "/opt/bitnami/frameworks/codeigniter/conf/certs/server.key"
  Include "/opt/bitnami/frameworks/codeigniter/conf/httpd-app.conf"
</VirtualHost>

new relic – php agent

Why isn’t the PHP agent for monitoring my Apps working?

We need to manually start it!

 

1. Install the agent.

apt-get install newrelic-php5

 

2. Start newrelic PHP daemon.

If you get this error, then go to step 3.

INFO: newrelic.cfg not found - daemon must be launched by the agent.

 

3. newrelic daemon failed to start because it could not find $ /etc/newrelic/newrelic.cfg. Make a copy of newrelic.cfg.template and rename it.

 

4. try start newrelic-daemon again:

/etc/init.d/newrelic-daemon start

 

5. Restart your web server or FastCGI Process Manager (FPM) as you normally would.


nano

search

ctrl + w