Basically WampServer = (Apache, PHP, MySQL on Windows). WAMP is the software suite installed on popular Windows operate system, includes Apache, MySQL, PHP and some other tools. It is derived from LAMP which stands for Linux, Apache, MySQL, and PHP. As the name implies, while LAMP is used on Linux servers, WAMP is used on Windows servers.
Note: Microsoft WebPI is another popular way to install wordpress on Windows server. But truly not recommend. I managed to get it working and eventually still find WAMP is better and easier to use.
For Windows: WAMP and Wordpress Install on AWS Free Tier Windows 2012 R2
For Ubuntu: LAMP and WordPress Installation on Ubuntu
1. Install AWS Windows Instance
My previous post Launch and Access Amazon AWS EC2 Instances has detailed steps how to launch one. This time , I choose Microsoft Windows Server 2012 R2 Base. I have tried 2016 Base, but since it is only has 1G Ram and 1 virtual core, 2012 is better option. Also keep it in mind , it is 64bit version. Later if you need to install any software, it is best to get 64bit version to do installation. Follow screen, make sure choose right Network (VPC), right Subnet (Availability Zone) and enable auto-assign public ip. I always assign a static private ip for my instance. It is much convenient to do configuration later cross multiple instances.
2. RDP into your windows instance
RDP process is standard. After you decrypted your administrator password, you can RDP to it as long as your security group opened the port. I always create another user and put it into administrators group for future access. In this way, I do not have to decrypt my administrator password each time when I need to access windows machine.
3. Download and install WampServer
http://www.wampserver.com/en/ provides you download link. Make sure you are choosing WAMPServer 64 Bits (X64) version. It is 431M file. But download it from AWS instance is just one minute thing.
There is one thing you have to be very careful. Before start installation, you will need to install all suggested VC redistributable packages includes vc9, vc10, vc11, vc13 and vc 14.. All download links have been provided in the Setup Information page. You will have to install those VC redistributable packages to start some services later.
4. Launch Localhost site
After installed WAMPServer, you should be able to see a green icon on your windows task bar notification area. open http://localhost page from your IE browser. It automatically load c:/wamp64/www/index.php file.
5. Install Wordpress
Download latest wordpress from https://wordpress.org. Since I like wordpress be my homepage. I copied all extracted files into c:/wamp64/www folder, which is default Web Site folder created by installation of WAMPServer.
5.1 Create wordpress DB
Launch PhpMyAdmin from http://localhost/phpmyadmin or from WAMPServer green icon.
By default, you can use root user to log in phpMyAdmin without password. Create a new database wordpress for your next step to install Wordpress.
Command line to create a MySql Database:
ubuntu@ip-10-10-0-50:~$ ping mysql2.c33rmuszoxid.us-west-2.rds.amazonaws.com PING mysql2.c33rmuszoxid.us-west-2.rds.amazonaws.com (10.10.0.117) 56(84) bytes of data. ^C --- mysql2.c33rmuszoxid.us-west-2.rds.amazonaws.com ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1006ms ubuntu@ip-10-10-0-50:~$ sudo mysql -h 10.10.0.117 -u johnyan -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16 Server version: 5.6.35-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> mysql> create database wordpress; Query OK, 1 row affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | innodb | | mysql | | performance_schema | | sys | | wordpress | | wp | +--------------------+ 7 rows in set (0.00 sec) mysql> use wordpress; Database changed
5.2 Configure Wordpress to connect MySql Database
use wordpad or notepad to open wp-config.php file under the folder c:/wamp64/www. change DB_Name, DB_User and DB_Password to the one as show below.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
There is no change on DB_HOST name since wordpress will only need to connect to local MySql. If you are using remote MySQL, that will be your remote DB server's ip address or DNS name.Use your IE browser to open http://localhost page again. You will get wordpress welcome page :
Enter site title and username / password which will be used to manage your wordpress site. Then you can click Install WordPress button to finish the whole wordpress installation process.
6. Publish Your Own Site to Internet
Now you have installed Wordpress site and it is working fine at http://localhsot this link. How about your own domain such as my netsec.51sec.org. How to get it working with your own domain?
6.1 Get your instance public ip and registered with your domain provider.
From AWS console, you should be able to get an automatically assigned public ip address. This public ip will change each time when you stop or reboot your windows instance. There is no problem if you just use it temporary. Or if you intend to keep it same all the time, you can get a fixed Elastic IP for free. In my test environment, 34.214.8.80 is one I got as temporary one.
My domain provider is GoDaddy. Under doamin 51sec.org, I added one A record netsec which value is 34.214.8.80. In this way, all request to netsec.51sec.org will be translated to public ip 34.214.8.80, which is my AWS windows instance.
6.2 Open your firewalls.
There are two firewalls. One is security group on AWS EC2 console. You will need to allow http (tcp 80) opened for 0.0.0.0/0.
Second is local windows firewall which is inside your windows server.
6.3 WAMP Configuration Change for Public Access
Open httpd-vhosts.conf by left one click WAMPServer green icon:
Change ServerName and Server Alias from localhost to netsec.51sec.org.
Also change Require to all granted
Change ServerName and Server Alias from localhost to netsec.51sec.org.
Also change Require to all granted
# Virtual Hosts
#
<VirtualHost *:80>
ServerName netsec.51sec.org
ServerAlias netsec.51sec.org
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
6.4. Restart All Services from WAMPServer green icon.
6.5. Change WordPress SiteURL and home Configuration
Since your wordpress was configured to use localhost, the siteurl and home configuration is set to http://localhost. They will need to change to http://netsec.51sec.org.
7. Make WAMP services Start Automatically
7.1 Log in as an administrator.
7.2 Start -> Run "services.msc"
7.3 Right click the service wampapache (may also be called wampapache64). Go to properties and set start-up type to 'Automatic'
If you want MySQL to also be available on startup, then repeat step 3 for wampmysqld (or wampmysqld64)
That is it. Now you should be able to get a published Wordpress site with your own domain name. AWS free tier windows 2012 R2 base server is enough to host a wordpress site with a couple of thousand visitors per day.
References:
No comments:
Post a Comment