Setting up DNS using your Domain Host (such as GoDaddy)
In your domain, just set the IP address to point to your new server IP (given to you by your provider, Rackspace or Amazon. You can do this by going on to the machine and typing
> ifconfig
Setting up DNS using RackSpace’s servers
Some DNS guides at rackspace are rather complicated and hard to manage. I would leave it to using the domain providers or your hosting provider’s DNS system. At rackspacecloud; and i presume most DNS settings have similar setting options, heres how its set:
you need
- 1x A record [which is IP],
- 1x CName record [which is www.mydomain.com],
- 1x MX record [which is mydomain.com; this allows asd@mydomain.com], and thats it.
A record
- Name = mydomain.com;
- Content = 123.45.67.89; [content is your ip address]
- TTL = 300;
- Name = www.mydomain.com;
- Content = mydomain.com;
- TTL = 300;
- Name = mydomain.com;
- Content = mydomain.com;
- TTL 300;
- Priority = 10 [if you use google apps, they will give you a huge list of 6 mx records, I know. its a pain. Enter them all by changing the Content, such as Content = aspx.googlemail.com]
Cherokee (is the alternative of Apache). Its non blocking style of http service make is outperform Apache in response. (http://www.cherokee-project.com/). To install it, open up terminal and type in the following,
> apt-get install cherokee
> sudo cherokee-admin -b
apt-get install lighttpd php5-cgi
/etc/lighttpd/lightly-enable-mod fastcgi [1]
/etc/init.d/lighttpd restart [4]
Now we can proceed to create a skeleton for your domains. This is so you can reuse it when you are adding new domains. Ignore this if you have just 1 domain.
cd /etc/skel
mkdir -p {backup,logs,private,public/uploads} [5]
now every time you create a new domain user, this will create a new structure. If you go to your domain from any browser http://123.45.67.89 you should see a lighttpd page.
cd /etc/skel/public/uploads
nano index.html
add in the following:
Site under maintenance, please come back later
[press crtl-x to exit nano]
Install php-myadmin
> apt-get install phpmyadmin
select lighttpd using spacebar then hit enter. when it asks to configure database for phpmyadmin, select yes. it will then ask for your mysql password, and ask you to set phpmyadmin password .
Before you start with .htaccess
Prevent downloading of your SQLite database
If you place your SQLite database in a public www directory it could be downloaded by a visitor. See the SQLite quick tips for creating a SQLite database in a safer way. Add or remove file extension if needed. Place the following code in your .htaccess file.
<FilesMatch “.(sqlite|sqlite2|sqlite3|sq|sq2|sq3)$”>
Deny from all
Custom error pages, “404 page not found”…
If you want to set your own error page for “404 page not found” and for other HTTP status codes you can do that easily in a .htaccess file.
Just replace the “404” with the the code you need and the file that should be shown.
Disable directory browsing
If you have an image directory that shows all your files when accessing it, you can disable this by placing an .htaccess file with the following code (notice the minus sign)
Options -Indexes
If you place a plus sign in front of Indexes it will list your files again. A simpler variant is just to place an index.html file in that directory, it will do the same thing. You decide 🙂
Change default index page
Want to have another index page than the regular index.html, index.php page? Change the myStartPage.html in the following code and then add all other index pages you need. If myStartPage.html is not found it will try index.html and then index.php (and so on).
DirectoryIndex myStartPage.html index.html index.php
Reference
Shamelessly quoted from: http://www.litewebsite.com/?k=tips
[1]some blogs say that we should add fastcgi-server={… config. The above was done without problems. perhaps bug fixed.]
so where are my http files? its at /var/www/
some blogs report memory leaks of lightly like a seive. Bahh. add in weekly cron server restart
[4] this will stop 403 errors when you try to access phpmyadmin remotely
[5] if you make a mistake you can use > rm -r xxxx to remove the xxxx directory.
Designing your webserver and access
Adding a new domain website
Install ftp server
> nano /etc/vsftpd.conf
* local_enable=YES
* chroot_local_user=YES
NOTES:
- [1] just by running vsftpd restart will give you a OOPs 500 error. You need to put “service” before vsftpd
- [2] or you can run > service vsftpd restart
- seems like vsftpd or other ftp software hooks onto user accounts. so for web servers, each domain should have a ftp account
- remember to set chroot
- by default openssh should be installed on ubuntu
FTPS for VSFTPD (Very secure ftp daemon)
> openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/vsftpd/vsftpd.pem -out /etc/vsftpd/vsftpd.pem
> chmod 600 /etc/vsftpd/vsftpd.pem
> nano /etc/vsftpd.conf
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
require_ssl_reuse=NO
# need require ssl reuse otherwise you get errors when you are editing files using ftps
# error “vsftpd: SSL connection failed session reuse required”
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
rsa_cert_file=/etc/vsftpd/vsftpd.pem
listen_port=21
#you can use any port, filezilla defaults to port 21. So does wordpress
pasv_min_port=20000
pasv_max_port=20999
# you will need this pasv, otherwise when you set up firewall, you get ftp connection problems. as a sample use 20000 – 20999
NOTES:
- Ref: http://ubuntuforums.org/showthread.php?t=518293