Need to access remote files from Apache server - apache

I am new to Apache.
I am running apache tomcat in windows and using JSP as the server side language.
I have a page containing links to the files (different machine) as below:
TheButterflyEffec(2004).avi
Superbad.avi
Why OnClick, saveAs is not working?
It is working if i save the page locally.
Do I need to configure anything in server.xml?

If the files are loaded on the machine running the apache then you need to look of two thinghs...
Put the files in a directory inside the apache root directory
In the <a href specify the file location with the ip address of it
(i.e. if your apache is on a machine with IP 192.XXX.XXX.XX then give the a href as follows
<
a
href='http://192.XXX.XXX.XX/folderWherefilesare/filename'>
filename < / a>

It's not working because the browser look for those files on the local visitor machine, not on the server.
You have to build "proxy" code with server side language like PHP that will get file name as parameter, e.g. Download.php?file=TheButterflyEffec(2004).avi then read the file from the server disk and send the file contents to the browser.
If you're using PHP indeed, here is an article describing what you can do:
http://www.boutell.com/newfaq/creating/forcedownload.html
Otherwise let us know what server side language you can use and retag your question according to this.

Related

Open server and "How did you get here?"

I have a project folder and i installed open server. In settings open server in domains i set the domain I needed and the domain folder with a link to my project.
but it is not possible to enter the page after starting the server, writes "How did you get here?
To redirect requests for a local IP address to the local domain you need, create an alias in the program settings.".
In file hosts it is not displayed that the open server is working with the specified server, writes instead "127.0.0.1 localhost".
What could be the problem?

MAMP PRO: The 'Path' to your remote document root is incorrect. but is not true - all files are there

The problem is incorrect path to remote host, but is not true. I have acces to my server via ftp without problems. All WP files are there and the site is working fine (frontend/backent). I have also access to phpMyAdmin to MySQL datepase binded to this site.
I have notce that paht to the web files is differ depend on FTP or SFTP is. In FTP app is such stright:
/[all wp files]
in editor app (such TextWrangler), after the samy access id/pass, I have got such path:
/home/[accountname]/public_html/[all wp files]
After click on detect button, app changing the path filed on:
- blanc - under FTP connection
or
- public_html - under SFTP
so it mean conection between MAMP and my server is working. Fine. But after this when I trying to Check URLs & credentials or when I trying Import Host... I received:
Error code: -3010 (The 'Path' to your remote document root is incorrect. The 'Path' field on the remote tab is the document root of your remote site that will be accessed via your Public Site URL (e.g.: 'public_html').) - Start auto detect not solved the problem.
or
Error code: -3113 (The 'Path' to your remote document root is incorrect. The 'Path' field on the remote tab is the document root of your remote site that will be accessed via your Public Site URL (e.g.: 'public_html').)
But it is not true! All files are there!
Please help. Should I use some special code under Apache tab (Additional parameters for VirtualHost directive or Directory directive?
Should I know something more from my serverprovider (home.pl) and solved this problem with them (there is no, in my subscription plan, access via cPanel or so, to set up something)?
Should I change something in https.conf file?
I'm not so using server coding so please forgive me but I have no idea where is the problem (but I'm trying to learn) :o)
My environment is:
MacOS X: 10.13.6
MAMP Pro: 5.2.2 (17923)
Thanx for any help or redirection to the answers someware else (I used searching ;o) but without success or I used wrong ask).
Just ran into this and found a solution that worked for me. I just had to switch the Public URL from https to http and it worked.
I had this error too.
Here's what I did to fix it:
Logged into my remote CPanel account
Created an FTP account for user#sitename.com
Defined the user directory in the FTP user settings similar to this /home/[site]/public_html
Ensured that this user had read/write permissions on the remote server (otherwise importing a site in MAMP Pro might fail)
Then, in MAMP Pro (v 6.0.1) created a new host following these steps:
https://documentation.mamp.info/en/MAMP-PRO-Mac/Create-a-new-host/Import/
I found that once the correct FTP permissions were set at the server, MAMP was OK and functioned as planned.
Good luck, hope this works for you too.

Virtual Directories not working in ColdFusion Builder 2016

I'm trying to set up virtual directories through the built-in Apache Tomcat 8 server using the ColdFusion Builder 2016 interface, however to my surprise this simply does not work, yet according to the documentation it should.
The only thing that I've modified was the web root directly in the server.xml file.
That said the website runs correctly, except when trying to reference a resource from a virtual directory which simply returns HTTP Status 404.
Web Structure
ColdFusion Builder Interface
The process when using the interface is as simple as:
Creating a virtual host;
Clicking the "Virtual Directory" button and setting up the directories; and
Applying the changes and restart the local server.
Ultimately this should allow me to navigate to the files (CSS, JS, Images) directly through the web browser.
Could I be missing a specific setting in a configuration file due to manually changing the web root? If not what am I missing?

Intellij idea opens static pages in browser with different url formats

Intellij idea has a nice "open in browser feature" that I use quite often for my static html files. Any html file can be opened in browser in two ways: 1. Idea has an internal web server that serves static content at http://localhost:63342/<relative path to content> . 2. Via file:///<absolute path> url.
After a recent update (14.0.2) the browser started to open pages as file:///<absolute path> although the internal web server is still present and all I need to do is edit the url. Very annoying. I searched a lot but still can't figure out how can I influence this behaviour so all my static pages would open in browser as http://localhost:63342/<relative path to content>
Specify the server connection settings:
In the Host text box, type localhost.
Use the Port spin box to specify the number of the port where the built-in web server runs. The port number should be set to 1024 or higher. By default this port is set to the default IntelliJ IDEA port through which IntelliJ IDEA accepts connections from services (63342).
Specify the folder that will be considered server document root. The folders that are under this document root in the project tree will be submitted to the PHP interpreter. The server document root folder will be accessed through HTTP at the above specified host:port.
In the Document root text box, specify the path to the relevant folder. This can be the project root or any other folder under it.
References
Idea Docs: Built-in Web Server

Accessing Local Media File to Play in FlowPLayer

I want to access local media file say .mp4 file to play in FlowPLayer on Firefox browser..
My application is based on JSF and RF3.3 with JBoss server.
Problem is in my backing bean say I have written a file name as test.mp4 and the same is being present in WEB-INF folder..FlowPlayer will access this file using:-
http://IP/ContextPath/WEB-INF/test.mp4
But now say suppose I have a file placed in my D: drive on my system. The local server is running on my system.I want to access the file kept in D: drive and play it in flowplayer...
FlowPlayer always append http://IP/ to the file name and as such it won't play the media file..
Is there any way out to allow flow player to access local file on the system...
I figured that it can be done using Apache...But how/??...
The component accepts a URL that must be accessible from the client browser, thus a url like file:///C:/resources/foo.mp4 would not work. The resource file you are trying to reference must be accessible from a web context. That is not to say that you can't store the file resources on the D: of your machine, but you would need a web server like Apache to access that folder location as a web context folder. It can be configured to do this, but I will not go into the details of how to do this, if you have trouble with that then you should post a question to the ServerFault StackExchange site for help with this.
One thing to keep in mind is that your web application is likely configured that any resources within the WEB-INF folder of your project is likely set to be the context path of your application. Thus if you you were to place your MP4 file in your web app (i advice against it, those files are enormous), then it would be accessible from http://site:port/applicationcontext/resources/foo.mp4 but on disk it is WEB-INF/resources/foo.mp4.
The best way that I set this up is to set up an Apache front end that is listening for web traffic on the specific port, then using the mod_jk module you can have Apache forward requests for resources at http://site:port/applicationcontext/ to your application server on the AJP port. I like this setup because I can keep large static resources at the ROOT context of the web server, as well as protect my application server by keeping it completely behind a firewall and inaccessible from the outside. The application server can only be accessed through the Apache web server meaning increased security. For more information on this type of setup, see this example guide on how to setup Apache Web Connector with Tomcat. http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html