Step 1: Log into the Dev Server using SSH

ssh ec2-user@ssh.factorydev.net -i factorydev.pem

— Step 2: Create the database

  • Use this command and replace “example” with the name of the database you would like to create:
    mysqladmin -uroot -p create example
  • The password for the dev database is:
    C6X0u2$1Nx79

— Step 3: Install WordPress for the New Site

  • To install WordPress, type:
    cd /var/www/dev
    wget http://wordpress.org/latest.tar.gz
    tar -xzvf latest.tar.gz
  • WordPress is now in its own “wordpress” directory. We will move the contents to the root folder:
    mv wordpress example.factorydev.net
  • Create the WordPress wp-config.php file:
    cd example.factorydev.net
    mv wp-config-sample.php wp-config.php
    vi wp-config.php
  1. Type i to start insert mode.
  2. Modify the database connection parameters as follows:
    define(‘DB_NAME’, ‘example’);
    define(‘DB_USER’, ‘root’);
    define(‘DB_PASSWORD’, ‘C6X0u2$1Nx79’);
    define(‘DB_HOST’, ‘localhost’);
    
  3. Add the WordPress config keys by generating them here: https://api.wordpress.org/secret-key/1.1/salt/
  4. Add the following right below define(‘WP_DEBUG’, false);:
    define( 'WP_MEMORY_LIMIT', '96M' );
    define( 'DBI_AWS_ACCESS_KEY_ID', 'AKIAJ5U3WLADWPMQNYIA' );
    define( 'DBI_AWS_SECRET_ACCESS_KEY', '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' );
  5. Press ESC then type :wq to write the file and quit vi
  • Fix Apache permissions
    chown -R apache:vpsusers /var/www/dev/example.factorydev.net
    chmod -R g+ws /var/www/dev/example.factorydev.net

— Step 4: Setup the vhost Config for the Sub-Domain

  • Edit the vhost.conf file
     vi /etc/httpd/conf.d/vhost.conf
  • Copy the code below and change out all of the example.factorydev.net for the folder you created in step 2.
    #
    # Example
    #
    <VirtualHost *:80>
    
        ServerName example.factorydev.net
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/dev/example.factorydev.net
    
        <Directory /var/www/dev/example.factorydev.net>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         allow from all
        </Directory>
    
    </VirtualHost>
    
    <VirtualHost *:443>
    
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/localhost.crt
        SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
        <Directory /var/www/dev/example.factorydev.net>
            AllowOverride All
        </Directory>
        DocumentRoot /var/www/dev/example.factorydev.net
        ServerName example.factorydev.net
    
    </VirtualHost>
  • Restart the web server
    service httpd restart
   

Start typing and press Enter to search