Is it possible to develop my websites locally before uploading them to my host? I need PHP and MYSQL. I’d like to have basically http access to my websites locally on my hard disk but restrict access to only me. No access outside of this machine. How to do this?
yes it is possible. most web developers do the whole site private behind firewall with webfolders blocked from outside. you would browse the website using file:///<localurl> to try it out. Then you can either render it to external server or turn your linux box into the server.
Others here may be able to help with the actual php/mysql set-up in a local nature. I have only done it once on an external server and the external framework was already set up for me so all I had to do was post the content.
You can install with Yast>view select Patterns then open the patterns tab and find web and lamp server.
I find it useful to install Webmin to manage the server. rpm available on the website. Requires a perl ssl module to be installed available from yast.
Once you get that far setting up your test site security is fairly simple something like
<Directory “/srv/www/”>
AllowOverride None
Options None
Order allow,deny
Deny from all
Allow from 127.0.0.1
</Directory>
Others can add more detail I’m sure.
The only issue you could run into is that the version of PHP on your local testbed is not the same as your hosting provider’s. There are some subtle differences and you have to account for these when testing locally.
OK. I installed the LAMP Server (Apache, MySQL, PHP) as well as WebMin and phpMyAdmin. So where does this go…
<Directory “/srv/www/”>
AllowOverride None
Options None
Order allow,deny
Deny from all
Allow from 127.0.0.1
</Directory>
In the .htaccess file in /srv/www/ ? Do I copy and paste it just like it is?
If you want access only to yourself, you might have noticed a “public_html” folder on your home. This will be your ‘ServerRoot’. As for php and mysql (and all the other dependencies you need) you can install them with zypper or yast.
The .htaccess is also nice. And you can find good docs here: Apache Tutorial: .htaccess files (this is if you really want to learn something instead of taking free hikes).
So what’s the difference between the /srv/www/ and the /home/public_html/ folders? Why two of then required?
stubble wrote:
> So what’s the difference between the /srv/www/ and the
> /home/public_html/ folders? Why two of then required?
The /srv/www is the directory one would use if setting up a ‘corporate’
site. The /home/USER/public_html is the location that individual users
can create web pages in. ISPs use this a lot. For instance, my ISP is
alaska.net. If you go to http://www.alaska.net you get their web page.
If, however, you go to http://www.alaska.net/~atftb you get my badly
out of date personal home page. The web server knows to associate the
~NAME with a users home directory.
This scheme allows everyone that has an account on the server to have
individual web sites w/o clobbering each other.
…Kevin
Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb
In a recent poll, seven out of ten hard drives preferred Linux.
By “corporate” do you mean for use by all users of this machine/network? By “web pages” do you mean also websites? So there isn’t a difference apart from who can access the content on this machine/network? If so, then I think I’d prefer to develop my websites on /home/user/public_html simply because it’s under my home directory, so much easier to access.
stubble wrote:
> By “corporate” do you mean for use by all users of this
> machine/network?
Sort of. Normally you wouldn’t give all users of the machine access to
the /srv/www site in a business or ISP situation. If it’s a home box or
a small business you might. It’s really just a matter of directory/file
permissions. In the apache conf file you define where your web sites
are. There’s really no difference between a ~/ site and the
/srv/www/htdocs site other than who has access and the intent of the site.
> By “web pages” do you mean also websites? So there isn’t a difference
> apart from who can access the content on this machine/network?
By web page, i mean an individual html file (and supporting files like
images). A web site is a collection of associated pages. But I can’t
remember exactly what I wrote now so may have used the terms loosely.
> If so, then I think I’d prefer to develop my websites on
> /home/user/public_html simply because it’s under my home directory,
> so much easier to access.
Yes, that’s a perfectly valid way to do it. Only thing to watch for is
when you reference files in the sub directories you use relative
addressing. For instance, I usually keep images in a directory called
img. In my home directory the path would be /home/mkm/public_html/img
whereas in the shared site (/srv/www) it would be /srv/www/htdocs/img.
When you translate that into the URL found in the web page you end up
with either http://YOURDOMAIN/img or http://YOURDOMAIN/~YOURNAME/img.
What you want is it to just reference /img. A lot of web publishing
programs will expand the path and you can end up with links that don’t
work because they’re pointing to the wrong path after the html files are
uploaded. If you just use /img when you specify the path, it works
because it is queued from the document root. Hope all that makes sense…
…Kevin
Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb
In a recent poll, seven out of ten hard drives preferred Linux.