1

What I'd like to do is develop a website from anywhere with an internet connection. The obvious answer would be to sign up with a web-host and pick a domain (e.g. project1.shoreline-development.com, or whatever). However, ideally I wouldn't want anyone else to be able to see the content of this site, as I would need to view error messages and so forth, so it would need an authentication layer to let me in to view my website, and within that it might need it's own authentication methods specific to the website software.

Does such a thing exist?

Thanks.

Edit: 09/11/2013 11:22

I believe I need to clarify the following: I would like to do development work from any machine with tools such as a web browser and winscp or an equivalent (preferably just the web browser). E.g. I'd like to be able to develop from my phone while sitting on a train, or my dodgy old laptop when I visit my parents, or a computer I'm borrowing from somebody else, or an internet cafe, or my work computer. The solutions posted are for a localhost development environment (which is understandable given that I didn't specify this part before) and would only work once I had set up the apache server on that computer.

Apologies for the misunderstanding, thanks for your help so far.

Shoreline
  • 798
  • 1
  • 9
  • 26

3 Answers3

0

.htaccess provides an easy way to do exactly that.

Sebastian Saip
  • 452
  • 2
  • 5
  • 17
  • I missed a detail which I've now added into my question. Would I be able to use .htaccess AND PHP sessions as separate authentication systems (let's assume I'm using zf2, for example)? – Shoreline Jan 09 '13 at 11:34
0

This is what you want (Think you are browsing http://localhost/test-dir1/ and you want others to not see this page)

.htaccess File Creation: 

$ cd  /var/www/html/test-dir1

$ vi  .htaccess

Write the following lines into this file:

AuthName "Authorized Users Only."

AuthType Basic

AuthUserFile /etc/httpd/conf/.htpasswd

require user testusr

You can also put in VirtualHost

Sahal
  • 4,046
  • 15
  • 42
  • 68
0

I'm using http authentication and authorization with apache2, to limit access per IP or per user/password :

If you set virtualhosts, a solution would be like the following :

<VirtualHost *:80>
    DocumentRoot "/path/to/document/root"
    ServerName subdomain.domain.tld        
    <Directory "/path/to/document/root">
            #Uncomment the following if you want restrict access per IP
            #Order Deny,Allow
            #Deny from all
            #Allow from A.B.C.D
            AuthName "Authorized Personel Only"
            AuthType Basic
            AuthUserFile "/Path/to/your/httpasswd/file"
            require valid-user

            allow from all
            Options +Indexes
    </Directory>
    ErrorLog        /var/log/apache2/domain.error.log
    CustomLog       /var/log/apache2/domain.access.log combined  
</VirtualHost>
cyberhicham
  • 495
  • 1
  • 10
  • 24