how to set username and password for Apache localhost. Need to upload files - html

setting username and password for Apache localhost. I want to be able to upload files using FTP protocal through the localhost, which means the localhost needs a username and password to enter. I am trying to test everything before I subscribe to a web server.
I have Apache 2.4 and PHP 7 installed on my windows 10 computer (no tomcat, no sql server or anything else). Using an html IDE I have written an index.html and other related files (css, php, js) and copied them (using windows) into the C:/Apache24/htdocs folder. I open a browser and type in localhost/index.html and everything is nicely displayed. But I won't be able to copy files to a subscribed server without knowing its username and password and connecting to it first.
I have read at least 50 discussions on Stack Overflow, Code Project and others but none of them address setting username and password without tomcat or sql server or something else.
As an aside, I was successful in password protecting a folder inside of htdocs using .htaccess and .htpasswd. I had trouble initially because I was missing the required Microsoft Visual C++ Redistributable(64) file.

Apache is a HTTP server! So you can't access it via FTP.
If you need to upload files you should create a form and coding server-side script in order to make upload in a subfolder of your apache root.

Related

Creating a conf file for a web server

For my web database I am trying to create a webserver so I need to make a conf file. When I try to edit my conf file and save it wont let me and says permission denied. I have already given myself read and write access, but I still don't have access to the edit the file. Here is the link to the resource I am using to set up my webserver : https://github.com/orsenthil/adminer-on-mac
I've been working with local web servers and mysql on Mac for over 15 years, so this recommendation is coming from that experience.
OS X updates will destroy your local web development environment every time you do a major OS update... Don't use the built in Apache, PHP and MySQL. Use Homebrew to install independent web server components.
Now to your problems:
/etc/hosts is a file not a directory. Each line is a separate record. The line they gave 127.0.0.1 apache.local just means that your local computer will be accessible from http://apache.local. This hosts file can be used to avoid DNS lookups for any website.
The conf file you are referring to is the Apache VirtualHost file? OS X is very protective about files in etc. Have you tried sudo? If you change the permissions to your user, Apache may not be able to function.

Upload css and html saved in a folder to host server

I'm new to programming generally. I have typed my css and html codes and saved in a folder. How do i upload this site to a host server. Thanks
Welcome.
To upload the files to your hosted server, you would need to use a FTP program ( File Transfer Protocol). A good free one to use would be filezilla, which a quick google search will come up for you.
Once you have downloaded filezilla you will need your server FTP settings, which you can find on your Hosted servers control panel. (They generally get you to create a username and password) you would need the FTP setting and Port with your login details, to be able to log in and start uploading your files.
One thing to be careful of, is the URL links for images/pages etc, as they may be different than if they were on your local machine.
You can use FTP (file transfer protocol) to achieve this. Download a free FTP client such as FileZilla, input your hostname and login information, and then you simply navigate to your desired server location and drag and drop.
You can read more about FTP here
https://en.m.wikipedia.org/wiki/File_Transfer_Protocol
Usually we have FTP (file transfer protocol) to send data to the server.
Softwares like Filezilla, for example, can connect and handle server's directories and files the way you want.
Anyway, you need to check the available services with your hosting service.

Connecting XAMPP to a domain and adding files

What I need is a web server hosting just for saving large files on it and share it online, so today I downloaded XAMPP Control Panel V3.2.1 as I read on a topic that it can help me.
Actually, I don't have enough knowledge about XAMPP, can I use it to upload files with normal domain(like: www.mydoamin.com/myfile)?, how can I connect the server I build with a domain after purchasing it? and how can I upload files to this domain.
Till now I done all the needed setup, and here's what I get when I start the application:
Also I can use the "MySQL" in the webpage after log-in, and here's how the page looks like:
Is there any recommendation for other application that helps me uploading files to my own domain/server and share it, if this one isn't for these stuff?
XAMPP is software bundle containing cross OS solutions (X) for webserver Apache (A), MySQL database (M), and server-side language PHP (P) and Perl (P).
If you got a domain you need to redirect it to IP on which this XAMPP server works. To do it call/mail your domain registrator (a company that sold you a domain) and ask about it. It involves DNS (Domain Name Server) configuration - ask them how to change DNS to direct it to your XAMPP server.
PS To add files go to htdocs direcotry in your XAMPP instalation or whatever you defined to store files (and websites) and drop your files in there.
As I can see you are not experienced in that kind of things so maybe ask company that sold you a domain name about "shared hosting"? It's preconfigured ready to go server where you send files over FTP

Access of the data by the server on the server machine

My question is I know that a server application can access the data stored at server but cannot access teh data stored at client machine as this is a security issue and Browsers not allow this. But in case of localHost (when my local pc is acting as a server) I should be able to access the files from my PC(the local PC on which the application is running). But that is not happening.
Why i m not able to access a simple image file form my local C:\ drive by localhost. The URL i used was file:///c:/image.png but if i store this image any where under home directory of tomcat i m able to access it. WHY ??
I m using it as <'img src="file:///c:/image.png>
Thanks for any considerations..
The problem is with this part:
The URL i used was file:///c:/image.png but if i store this image any
where under home directory of tomcat i m able to access it.
If you want to access the file through Tomcat after placing it in Tomcat's document-root, then the URL to use (assuming you haven't changed the default port setting) is:
http://localhost:8080/image.png
Content hosted by the web-server needs to be accessed through the web-server. A file:// URL bypasses any sort of server, and basically directs the browser to look directly in the local filesystem. So it should also work if you were to do:
file:///C:/path/to/tomcat/home/image.png
But in that case you are not going through Tomcat. You're just pointing the browser at the tomcat folder in your local filesystem.
Edit: I don't think many browsers will not allow file:// urls in tags in hosted documents. Doing so could cause the appearance of a security hole, as if you could guess the name of an image file on someone's local filesystem you could then post a webpage that made it appear as if your server had somehow grabbed their personal image file.

Uploading MVC Website and MySQL to Webhost

I created a website using Code Ignitor and MySQL and want to upload everything to 000webhost.com
How do I:
upload my models, views and controllers to the public_html folder of 000webhost?
get my MySQL database up and running on 000webhost?
Thanks in advance
I am presuming that your control panel is cPanel. If thats the case then upload all your files in the web root of the server. Create a database, and change that details in database.php inside config folder. thats it, your site will be up and running.
Your .htaccess (at least mod_rewrite for codeigniter) will not work if you use the free 000webhost service (at least the last time i wanted it, the support told me that they doesn't support it... that was thy time i signed up for their free service for private test of scripts i wrote). Another thing is that for the free hosting they use their own control panel (not cPanel), cPanel is for the paid accounts.
Anyway they both offer ftp accounts, mysql databases and of course web ftp (online file manager). All you need is a ftp client (such as FileZilla or even Windows Explorer itself).