Showing posts with label amazon EC2. Show all posts
Showing posts with label amazon EC2. Show all posts

Thursday, April 4, 2013

using filezilla for amazon ubuntu server

when you create ubuntu instance on amazon ec2, you will get user name(say, root or ec2-user) and one .pem file
then in your local ubuntu, you can access the server by:
chmod 400 xxx.pem    #make this file publicly visible
ssh -i xxx.pem ec2-user@xxx.xxx.xxx.xxx
# xxx.xxx.xxx.xxx  is the ip address amazon assigned to you
thus you can access the ubuntu server on amazon.
however, for transfering files between local machine and server, we usually use filezilla.
the default internet access directory is  /var/www/html  however, the general user do not have rights to upload files directly to this folder, so we can:
sudo chmod 777  /var/www/html 
thus we can use filezilla to transfer files directly to that folder.
after installing filezilla, we should configure first:
1)open the site manager->new site. then we name it as something you like, and for host, input the ip address, for port:input 22, for protocol: choose SFTP-SSH file...    for logon type: normal   for user: input your user name
2)edit-> settings->connection->SFTP, press: add keyfile. thus select your pem file, and  will convert it to ppk file.
after that, back to step 1), press "connect", then your local machine would connect to your amazon ubuntu server. You can now use mouse to drag files from your local machine to the server and vice versa.

Thursday, February 28, 2013

using php to send mail on iis(windows server 2008)

I know php might show better performance on apache, however it happened that I only have a windows server 2008 on amazon EC2 with iis installed. A senior student want me to finish the sending mail function with using php, so I have no other choice so far.

It seems very easy, every one know that php has the function mail(). But, this function only could easily run on linux almost without any configuration, while on windows, it is another story.

I spent days to find that there two basic methods:
1. directly use the SMPT service on iis
2. use some  other classes: phpmailer or swiftermailer

I choose the 2nd method first, unluckily, no matter how I configure, it  dose not work, so far, I still do not know why.(still think about it)

then I switched to 1st method,
in windows server2008, the smpt server is not installed by default, so you should install and configure them,
I use the following two steps to finish the task:
1:to install the smtp server:
http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configure-smtp-e-mail-in-iis-7-and-above

2. configuration and code testing
http://geekswithblogs.net/tkokke/archive/2009/05/31/sending-email-from-php-on-windows-using-iis.aspx

done!