To enable SSL in apache httpd server, you need to have mod_ssl module installed. Below commands will install apache with mod_ssl.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then you need to create key file and the cert files.
Create the key file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.key file is your private key. After generating key file and the cert file, you can configure httpd.conf file.
Configure httpd.conf
Make sure mod_ssl.so is enabled in modules list section.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now restart apache server and now your http server will only accepts https requests.
To work with apache HTTPD server 2.4.3, you need to have openssl-1.0.1e or higher. If your current openSSL version is minor to this, you will have to set LD_LIBRARY_PATH to a newer version.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Perl is very good scripting language since it has lot of in-built modules to do lot of complex tasks that you would not be able to do with shell scripts. For example, if you want to insert data in to mysql data store or if you want to connect to a AMQP channel and get messages, you can use inbuilt modules in perl. In this blog, I'm summarizing some very useful functionalities that I was able to do with perl.
Read a config file and assign values to variables from the file
Connect to MySQL data store
Execute a query in MySQL data store
Creating a directory
Go to working directory
Replace a string in a file with another string
1. Read a config file and assign values to variables from the file
Suppose name of the configuration file I have is "config.ini". In here we use , Config::Simple perl module. If I have a parameter called "host" in my config file, below is how I read the config file and assign the value for host parameter to a defined variable in the perl script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cfg is a hash map. It will contain all the parameters that are defined in that config file.
2. Connect to MySQL data store
In here we use, DBI and DBD::mysql perl modules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In here, $host is where your MySQL server is running, $userid is the database user and $passwd is the password for the given db user. Once you execute this, you will connect to the MySQL store that is running in the given host with given user name and password.
3. Execute a query in MySQL data store
Once you connect to the MySQL data store, you can execute queries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In here, $connection is the connection object that you get, when you connect to MySQL data store.
4. Creating a directory
To create a directory, you can use File::Path module of perl.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In here, it creates a directory called IUGateway and another directory called UBMoD inside IUGateway directory.
5. Go to working directory
Suppose you want to do a maven build by going to your source directory. Below is how you can jump to whatever directory that you wish.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are lot of occasions where you want replace strings in a file with some other string. Here is a example how you can do it using perl.
If you have only single instance of that string, here is what you can use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here $user_substr is the original string in the file. $http_running_user is the value that the original string will be replaced. When you replacing, make sure you don't have special characters such as ":", "/" inside that string. $httpd_conf_location is the location of the file. In perl you can run any command that you run in the command line inside "system".
If you have multiple occurrences of the same string and you want to replace all the occurrences, here is the command that you can use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All the above commands are extracted by googling. It took me lot of time since I'm very new to perl. I hope this post will be helpful for someone like me.