0

As a side business I design and build websites for small businesses. I want to have a server on a shelf in my office to act as a development server. It would have working copies of all my clients websites. I could develop, test & edit there and then upload to their real locations when I am done. Is this possible without being a Ubuntu Guru? My intent is not necessarily to serve pages outside my house although that would be a nice feature. I hate how clunky windows IIS is to move the pointer to a different folder when I move between clients.

Thank you.

  • All things are possible. Please help us help you by describing what you've tried and the results! Better yet, please review http://askubuntu.com/help/how-to-ask – Elder Geek Jan 15 '15 at 21:08
  • Its a bit out of date, but this would be the general process. http://code.tutsplus.com/tutorials/how-to-setup-a-dedicated-web-server-for-free--net-2043 – amanthethy Jan 15 '15 at 21:10

2 Answers2

0

Is this possible without being a Ubuntu Guru?

Yes. Ubuntu in this is just the OS hosting the tools you need. The initial setup for apache and your network might be a bit difficult the 1st time. But nothing a bit of googling or searching on AU can not fix.

You need (and probably know this but just in case) ...

  • Apache config to host the websites. A setup with virtual hosts. It is probably a copy of the virtual hosts of the live system. Pretty basic if you are already into Apache.
  • something (like ssh/scp/rcp) to copy software over. We tend to use rcp to remote copy software between systems.
  • Probably MySQL for the data. You can use the my.cnf from the live system to set up your test system. Replication is a nifty feature: if you replicate your live data to your test system (live as master, test as slave) you can test your system on a copy of the live data. Example as we use it: live is master, slave #1 is used to do the heavy sql queries on and slave #2 is a backup in case the master is unreachable. And from slave #2 we also create the daily backup (so the active live system is not burdened with it).

    Besides that you can also use workbench to copy over complete databases from live to your test system. This is nothing fancy.

Rinzwind
  • 299,756
  • This is excellent information! I will start gathering all my software & hardware now. I am looking forward to the challenge. – Paul of Chester Jan 16 '15 at 14:35
  • I also wrote this recently: http://askubuntu.com/questions/574074/i-have-just-installed-lamp-server-through-tasksel-can-i-use-it-in-any-graphical/574075#574075 And don't forget to upvote/accept if it fits your question :) – Rinzwind Jan 16 '15 at 14:37
0

First of all, This is possible to do: 1. Download Nginx or Apache (I use Nginx so the configuration below is for Nginx):

sudo apt-get install nginx

you might need to install php5, mysql etc when you configuring nginx, here is the dependence you need

sudo apt-get install php5 php5-cli php5-cgi spawn-fcgi php5-mysql php5-mcrypt php5-curl php5-gd php5-fpm openssl mysql-server

2.Configure Nginx

  1. Go to Nginx directory and delete unnecessary files

cd /etc/nginx/ rm sites-available/default rm sites-enabled/default

  1. Configure for Website

cd /etc/nginx/conf.d touch website-name.conf

  1. open .conf file you just created and paste the configures below

nano /etc/nginx/conf.d/website-name.conf

 server {

    listen [::]:80; #ipv6only=on; ######STEP1#####
    server_name www.whateveryoulike.com;  #####STEP2####
    root /path/to/file; ######STEP3#####


    index index.html index.php;
    location / {
        try_files $uri $uri/ @handler; 
    }
    location @handler {
        rewrite / /index.php;
    }

    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }


    location ~ \.php$ {
        #try_files $uri $uri/;
    fastcgi_index index.php;
        expires off;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/var/run/php5-fpm.sock; ######STEP4#####
    include fastcgi_params;
    }
    #include /etc/nginx/fastcgi.conf;

} 

Step 1: this is port that your website is bind on

Step 2: this is where your server name is written (you can have a server name whatever you like)

Step 3: this is where your root directory is written (it must be same as your git clone location)

Step 4: this is where the php5-fpm directory is written (nothing has to change but leave it for future use such as zend server )

For Version Control Use Github or Bitbucket if you enjoy privacy.

I personally use Bitbucket, the process is simple as 1 2 3 4 1. Push your Live site files as master

  1. pull the code to your pc (this is the file location for nginx)

  2. edit , delete , add files to the local version( staging, etc )

  3. when you done push it to bitbucket, and pull it back in live site's shell.

Finally , Relax and You're Welcome