Showing posts with label Amazon EC2 Server. Show all posts
Showing posts with label Amazon EC2 Server. Show all posts

Monday, 25 February 2019

Password protect to directory on the web server and Add a new user

Allow User to access the app 1. Create/Update `.htaccess` file in root directory:
    touch .htaccess
    vi .htaccess
Then, add following content:
    AuthUserFile /home/bitnami/htdocs/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Application Authentication"
    AuthType Basic
    require user demo-user1
    require user test-user2
3. And, for passwords, create `.htpasswd` file in root directory.
    touch .htpasswd.
4. To add/edit password, run the following command:
    htpasswd -c .htpasswd demo-user1
    
And, follow instruction ahead.

Wednesday, 30 December 2015

To copy the local files to Remote Linux Server (Amazon EC2 Instance)

To copy the local files to Remote Linux Server (Amazon EC2 Instance) :

First, generate and dowmnload the ec2-instance-key-pair.pem file form AWS EC2 to your computer.
To do that follow the instruction here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

Then run the below command by locating the .pem file and name of file to copy and location of directory into and AWS server:

scp -i /c/KeyFolderPath/ec2-instance-key-pair.pem /c/Users/YourFolderPath/instantclient-basic-linux.x64-11.2.0.4.0.zip ec2-username@ec2-198-51-100-1.compute-1.amazonaws.com:/home/destination_folder_path

To find more information here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Thursday, 21 August 2014

Apache does not start when using Virtual Host on BITNAMI WAMP Stack

Updated on 19.12.2014

If you are using the Bitnami WAMP Stack, be careful while you setup the virtual host for your site (on local machine, Amazon EC2 or other Cloud).

First Steps:
  1. Open the /wampstack/apache2/conf/httpd.conf
  2. Search for [ conf/extra/httpd-vhosts.conf ] and uncomment that line (normally it should be line > 492 under the # Virtual hosts )
 Also, you may need to change port to 8080 or to 80 depends on your system requirement.

-------------------------------------------------------------------------------------------------------

If you are using the Bitnami WAMP Stack, be careful while you setup the virtual host for your site (on local machine, Amazon EC2 or other Cloud).

Firstly, wamp_intall_folder/apache2/conf/extra/http-vhosts.conf doesn't work anymore if you using Bitnami WAMP Stack. Instead, it uses wamp_intall_folder/apache2/conf/bitnami/bitnami-apps-vhosts.conf

1. Then, add the following content to setup of the Virtual host.
< VirtualHost *:80 >
 ServerName dev.testapp
 DocumentRoot "wamp_intall_folder/apache2/htdocs/testapp"
 
 Include "wamp_intall_folder/apps/testapp/conf/httpd-app.conf"
< /VirtualHost >


And, rest of configruation is exactly same for both.

OR Alternatevly,
you can configure same thing in a slightly different way, they rather Include the vhost.conf file and setup separately for each application.

I. First, create new folder on apps/ folder, in this case I am creating testapp/:
  wamp_intall_folder/apps/testapp

II. Then, create conf/ inside the above testapp/ folder.
  wamp_intall_folder/apps/testapp/conf


III. Then, create httpd-vhosts.conf file inside the above /conf folder;
  wamp_intall_folder/apps/testapp/conf/httpd-vhosts.conf

Then, add the below content on httpd-vhosts.conf file

< VirtualHost *:80 >
 ServerName dev.testapp
 DocumentRoot "wamp_intall_folder/apache2/htdocs/testapp"
 
 Include "wamp_intall_folder/apps/testapp/conf/httpd-app.conf"
< /VirtualHost >

IV. Further, create httpd-app.conf file inside the above /conf folder with the below content.
  wamp_intall_folder/apps/testapp/conf

 Then, add the below content on httpd-app.conf file

 < Directory "wamp_intall_folder/apache2/htdocs/testapp" >
  Options Indexes MultiViews
  AllowOverride All
  
  < IfVersion < 2.3 >
   Order allow,deny
   Allow from all
  < /IfVersion >
  
  < IfVersion >= 2.3 >
   Require all granted
  < /IfVersion >
  
 < /Directory >
 
On above steps 3 & 4, the wamp_intall_folder/apache2/htdocs/testapp is the folder where your actual project or app folder where all the php files are placed.

V. Now, lets go to the wamp_intall_folder/apache2/conf/bitnami/bitnami-apps-vhosts.conf file and add the below line
# Bitnami applications installed in a Virtual Host
Include "wamp_intall_folder/apps/testapp/conf/httpd-vhosts.conf"

2. One more step,  open the hosts file from the C:\Windows\System32\drivers\etc\hosts, in case of lixux or EC2 Server, it can be different location, please check before you add the below line.
Add the below line and save the file.
 127.0.0.1       dev.testapp

3. Finally, you have to restart the Apache server, if you browse by
http://dev.testapp/

Enjoy!

If anything, please let me know.

Friday, 8 August 2014

Email receiving issue as Gmail and other servers throws all outgoing emails to SPAM Folder?

If your website has been previously been black listed due to a pounding of SPAM emails.

Well, I am sure you definitely backed the website to normal, however, if you may face the email receiving issue for all outgoing emails from the same server. Particularly, those sending email seems delivered smoothly, however, on receivers end, they emails may be marked as spam and thrown them to SPAM folders. This often happened with GMAIL and other few servers in my case.

To resolve the above issue, the following steps may be useful;

1. Check your website (server) IP address for blacklisting by searching on below websites and delist them from there or request them to delist your IP. Please refer few websites below for checking blacklisting;
 http://multirbl.valli.org/
 http://lookup.uribl.com/
 http://www.blacklistalert.org/
 http://mxtoolbox.com/blacklists.aspx
 http://www.spamhaus.org/lookup

2. You should consider publishing SPF and DKIM records for these domains. To do that, go to your cPanel -> Email Authentication -> Enable DKIM and SPF and copy the records into the Domain DNS Manager for your domain.

The SPF (Sender Policy Framework) 
is system allows you to specify servers and IP addresses that are authorized to send mail from your domain(s). This feature works to prevent outgoing spam messages. SPF should look like below;
v=spf1 +a +mx +ip4:78.31.107.194 ?all

DKIM (DomainKeys Identified Mail) 
is a means of verifying incoming email. It ensures that incoming messages are unmodified and from the sender from whom they claim to be. This feature works to prevent incoming spam messages. DKIM should look like below;
v=DKIM1; k=rsa; p=MIGfMA0XCSqGSIb3DQEBAQUAA4GNAPCBiQKBgQDiZT6OFmmJWU/Bepyd54k3b48voH2RUzzQV7fp1vTTFGWXu72JSfBdq5ZgCMoETP/q1crHJ2ghT+X+97FVsuudY7D1Ejk6GuvleuUVQtbCfoqU11igcVqItcUttA30CSSL85riDztruFCh/1TU7SQuNNvLdoH8lcjNOWJBeAskqQIDAQAB;

If you had faced the same problem and resolved it, I would love to hear about that (comment me) here..

Thursday, 31 July 2014

Quick way to check for IMAP Enabled/Disabled on PHP Web server

Please execute the below syntax to check for IMAP feature enabled/disabled on your CPanel

// Code to check for just for IMAP info
var_dump(get_extension_funcs('imap'));

// Below code is to get the server configuration and check for PHP IMAP status
phpinfo();

If IMAP is enabled, the var_dump should return array of string related to imap as below;
array(75) { [0]=> string(9) "imap_open" [1]=> string(11) "imap_reopen..........

Also, if IMAP is enabled, you should able to see below information when you execute phpinfo(); as below;
IMAP
IMAP c-Client Version 2007f
SSL Support enabled

If IMAP is disabled,
Otherwise you would just able to see:  bool(false)

Thursday, 28 July 2011

Status of Amazon EC2 Server

To check the status of Amazon EC2 Server:
1
# tail -f /var/log/apache2/error.log

Cron Jobs at Amazon EC2 Server

Show you the list of cron jobs:
1
# crontab -l
It is a standard unix cron job file located in /var/www/project/_config/crontab.txt.