How can I host a file server on the web? - webserver

I would like to be able to host my own file server so I can acess my files whereever I am. I tried countless tutorials but none worked in the end. The only thing that works is acessing my files on my local network.

Related

How to configure apache2 on Raspberry pi to serve https?

I am trying to use a Raspberry Pi 4 Model B as a small web server. It works fine for unsecured http, both within my home LAN and over the net. I have obtained a domain name and SSL certificate and key file. I am testing the server by accessing it within my local network using a browser and the Pi hostname. Unsecured http works fine, but making an https request results in a delay and then a "host refused to connect" message on the browser.
I have found conflicting instructions on the Web as to which Apache configuration file needs to be edited to include paths to the SSLCertificateFile and SSLCertificateKeyFile.
Within /etc/apache2 there are sites-available and sites-enabled subdirectories and more than one *.conf file, but apparently I have not edited the right one.
So, first, which is the correct configuration file to edit with the certificate paths, and second, does Apache produce a log file somewhere that would reveal any error messages produced by errors in the certificate?
I found a more complete set of instructions that showed how to add a port 443 virtual host to the default-000.conf file. It is working now.

EasyPHP - is it possible to replace Webserver to Devserver?

I'm wondering, wheter it's possible instead of two installed apps (EasyPHP Deveserver & EasyPHP Webserver) to have installed only one - EasyPHP Devserver. This app would be somehow modify to allow access from another computers:
A) from LAN,
B) from WAN.
I'm interested in both of solutions; is it somehow possible (probably by the unoficiall way, because I didn't find it on settings) - did anyone try to? (Or do I have to have EasyPHP Devserver for my PC and EasyPHP Webserver for access from 'everywhere'?)
The reason is, why I want to do it, is just for developing purposes (and I read somewhere, that Devserver is for this more suitable and I don't wont to have two folders on Devserver and Webserver and copy the files everytime).
I have a solution:
open a file httpd.conf. It should be on folder EasyPHP-Devserver-17\eds-binaries\httpserver\apache\conf.
Add behind Listen 127.0.0.1:80 line with your PC's IP, eg. Listen 192.168.1.1:80.
Then everywhere within the document (approx 5 times) replace 127.0.0.1 to 192.168.1.1.
Now it's working.

Redirect/rewrite to different internal IIS sites using query string

EDIT: Ugh I forgot to put this on Server Fault...
I have an Azure VM that is hosting a web application.
The application will be accessible via the VM's IP address:
http://191.238.112.62
I want to be able to use query strings to redirect to completely different sites that are within the local IIS. For example:
http://191.238.112.62/?site=1
would redirect to
www.site1.com
The way I have structured IIS can be seen below:
Each site has an entry in the systems host file.
127.0.0.1 wwww.site1.com
127.0.0.1 wwww.site2.com
127.0.0.1 wwww.site3.com
There is likely a better way to achieve what I am going for here so any pointers would be greatly appreciated.
Thanks.
Here is how I would do it. Not sure why you want to use query strings for this as IIS is made to do that if you configure it properly.
In your DNS server register all your websites to point to that IP. This is for when you go live. For development the hosts file is a good solution.
When you create the websites add a Host header like below
Now try loading any website by their full name
http://www.site1.com
http://www.site2.com
http://www.site3.com
Here is more info about IIS host headers.
Again, when you go live make sure you have the DNS set up for all the websites to point to the IP address of your server.
Hope this helps.
Edit based on comment:
Right, here is how I solved this in the past.
You can do all this with the hosts file but it's less painful if you have a proper DNS server to resolve the names.
The basic idea is to use slightly different URLs for development on the local machine.
All devs would have site1.com point to the IP of the shared server and site1.com.local point to 127.0.0.1. So a hosts file on a developer machine would look something like:
191.238.112.62 www.site1.com
127.0.0.1 www.site1.com.local
On all development machines you need to make sure you have the .local host header for all sites.
On the shared server you just need to add the right host headers and no hosts file changes. It's actually a bad idea to change the server hosts file.

How to connect and read/write file to a local computer on iphone?

i have a problem with local network connection. i'm writing an iphone application and i need to read/write files to a computer. Both devices connected on the same network.
if it's possible, i want to get connected computers ip list, select one of them and read/write files like pdf, doc, txt etc.. if it's not possible to do, i will write the computer ip which i want to connect. There is no problem, both of solution is OK.
But i dont know what do i do after get the computer's ip ?
i found this chat client/server on local, but i got it very complicated.
Anyone have any idea about this ?
You'll need to have a server running on the computer, which can show files and allow for files to be read and created.
Easiest is to run a webdav service on the computer, Apache provides the mod_dav module for this purpose.
The iPhone app then becomes the client. I'd suggest using neon for this purpose. It's a C library that provides listing, reading and writing files on a remote webdav server.
That's how I would do it.
1) Find the network address of the computer you want to connect to. For this you can make use of Bonjour. It's very easy to setup because Bonjour handles the resolving of address for you.
You just have to publish a service (e.g. _myprotocol._tcp) via the ´NSNetService` class which is available on iOS and OS X (Windows too)- in your case you would publish the service on your computer.
Then you search for the service with the NSNetServiceBrowser class.
When you found a service you can then resolve it. This actually gives you the network name of the other device.
2) Connect to the other device via a tcp socket. The CocoaAsyncSocket library is very good at this. This project also includes some examples. One example already provides a bonjour server and client implementation.
i found exactly what i want. The solution is here

Viewing a local web site on the LAN under a different hostname

In short I'm trying to browse a Mac's web site on the local wifi network under a .local hostname that is not the same as the machine's 'computer name' and think I'm missing a setup step.
I have a local install of nginx on my Macbook, with the proper /etc/hosts and nginx.conf entries to serve multiple sites, each with their own distinct local hostname. Assume the Macbook's network name is computername.local, and I have 2 sites running, one at http://computername.local and another at http://servicename.local. I can access each of these sites just fine from the local machine, but also want to be able to access http://servicename.local from an iPhone on the same WiFi network. I'm getting a timeout for that URL, but the other one works just fine.
I'm guessing something has to be done to allow servicename.local to be used on the local network, which I've left out. What is required to do that? Do I need to use Bonjour for that? Where would I add this new local hostname?
Another Mac on the same network can access this one under servicename.local just fine if I define the IP in its /etc/hosts file too, but I can't modify that file on the iPhone obviously. It's not jailbroken, and I'm not really interested in doing that just to get this working.
Not sure if it will help the OP, but another way of doing this - besides running a DNS server or jailbreaking the phone - is to run an HTTP proxy on the Mac, and configure the iPhone to use the proxy. Then the iPhone will pick up the Mac's local hosts file entries because it resolves DNS queries through the proxy. I've blogged about how to do this using the free Mac proxy "SquidMan" here: http://egalo.com/99j