Deployment Amazon Lightsail deploy LAMP LAMP application of monolithic applications

LAMP deployment of monolithic applications

Here Insert Picture Description
Description: by copying the application code and provides links PHP front-end and the parameters of the local MySQL database, LAMP will play against deploying applications to Lightsail previous instance of the startup. Upon completion, Apache / PHP front end and MySQL database will run on the same host. You will be deployed to Lightsail application code examples, and the connections between the MySQL database and configure PHP applications running locally.

1, using SSH to connect to your LAMP instance (using SSH Web interface or using a putty connection tool to connect)
2, LAMP BitNami image installed some default page, you need to remove it in order to deploy PHP applications to back :
cd /opt/bitnami/apache2/htdocs && rm -rf *

3, the application code using Git cloned into the server:
**

wget https://s3-us-west-2.amazonaws.com/us-west-2-aws-training/awsu-spl/spl-220/scripts/todo.zip -O /tmp/todo.zip
unzip /tmp/todo.zip

**

4, PHP applications that use files ( config.conf ) to connect to save the information (database host name, user name and password) required database. You must create a directory for files, and use bitnami become all the user:
**

sudo mkdir /opt/bitnami/apache2/configs && \
sudo chown bitnami:bitnami /opt/bitnami/apache2/configs

**

Note: As a best practice, do not expose your sensitive information is stored in the document root of your Web server, ideally, in production, you will use the secret management solutions, such as AWS Secrets Manager

5, to move the config.php file configuration directory ( / opt / BitNami / apache2 / configs / )
sudo mv /opt/bitnami/apache2/htdocs/config.php /opt/bitnami/apache2/configs/config.php

6, everywhere environment variable to help edit the configuration file, note that the default password is stored in the main directory of the database instance ( / Home / BitNami / bitnami_application_password ) in the file.
**

ENDPOINT=localhost && \
username=root && \
PASSWORD=$(cat /home/bitnami/bitnami_application_password)

**

7, verification environment variables:
echo "Endpoint = "$ENDPOINT && echo "username = "$username && echo "Password = "$PASSWORD

8, back up the original configuration file:
cp /opt/bitnami/apache2/configs/config.php /opt/bitnami/apache2/configs/config.php.bak

9, create a new configuration file has been used locally installed database. Use the following command sed browser configuration file and replace the placeholder values of environment variables you set in the previous step, these values will write the new file ( cibfug.php.monolithic ):
**

cat /opt/bitnami/apache2/configs/config.php | \
sed "s/<endpoint>/$ENDPOINT/; \
s/<username>/$username/; \
s/<password>/$PASSWORD/;" \
> /opt/bitnami/apache2/configs/config.php.monolithic

**

10, to verify that by ensuring that the value of the matching profile and the value of the environment variable single-chip configuration file is correct:
cat /opt/bitnami/apache2/configs/config.php.monolithic

11, the configuration file will be put into production:
cp /opt/bitnami/apache2/configs/config.php.monolithic /opt/bitnami/apache2/configs/config.php

12, by ensuring that the value matches the value of a single file for the production of profile display is being used to verify whether the correct production profile:
cat /opt/bitnami/apache2/configs/config.php

Please note that after updating the configuration file, your PHP application to connect to a local database engine;

In a real application, you will define how the production process to prepare a database for the demo application, you need to run a PHP script:

13, open a Web browser window tabs prepare the database, and then type:
Example: HTTP: //PUBLIC-IP/install.php

Please note PUBLIC-IP replaced with the public IP address of your Lightsail instance

Press ENTER to enter the web interface
Here Insert Picture Description

14, in the browser, the following ways to navigate to a running application:
enter: HTTP: // the PUBLIC-IP

Note here PUBLIC-IP is an example of your public IP address Lightsail

15, click "Add Task" (add a task), add some tasks on their own
Here Insert Picture Description

Guess you like

Origin www.cnblogs.com/zhijian1574/p/11957150.html