Scenario:
1.My web application is hosted in the following IP (13.67.3.12).
2.We have 'Browse' option for selecting the file. If I open the browser window from the client machine (13.67.3.21) it is showing local machine directory instead of it should open server (13.67.3.12) machine folder directory. Is it possible in web application?
Is there any way to do it using javascript/jquery/node.js/anytools?
One way to do it is to create a shared folder on the server, then assign permissions to the share based on either a active directory service account, or user group. In the file dialog options, you can set the start directory of the dialog. You can set this to default to the shared folder location.
Related
I have my application developed in node.js, and I have cyberpanel installed on my server. I have seen many examples of how to deploy a node application in cyberpanel, but I have doubts about how to view it from the browser.
So far I have the following configuration in vHost:
context / {
type appserver
location /FOLDER/FOLDER/PROJECT_FOLDER/dist
binPath /usr/bin/node
startupFile index.js
appType node
maxConns 100
}
My application runs perfectly on port 3000 when I run it by console, but I need to list it on port 80 with cyberpanel.
Does anyone have an idea how to do it?
try the following steps. Essentially, the error lies in selecting the root document folder and allowing access to the application.
Create a Website using the normal CyperPanel menu. [https://cyberpanel.net/docs/2-creating-website/]
Upload your Node.Js files into the public_html folder of the website.
Enter the Open Lite Speed panel via port :7080 (you would need to enable the port on the firewall)
Navigate to VH Hosts > Your Domain > Context
Select App Server, for location using $VH ROOT instead of the hardcoded path worked.
Additionally, don't forget to enable the site on access control via allowing all IPs (*).
context / {
type appserver
location $VH_ROOT/public_html/
binPath /usr/bin/node
appType node
startupFile server.js //this is the name of your
appserverEnv 1
maxConns 100
accessControl {
allow *
}
rewrite {
}
ad
See I am going to answer point to point to the question
First of all cyberpanel by default only takes app.js file as its core file to run the application.
Second, How to change that default file pointing ?
context / {
type appserver
startupFile index.js // **NAME OF YOUR STARTUP FILE**
location /home/PROJECT_FOLDER/public_html/dist
binPath /usr/bin/node
appType node
appserverEnv 1
maxConns 100
accessControl {
allow *
}
rewrite {
}
ad
location /FOLDER/FOLDER/PROJECT_FOLDER/dist
Note :- Things, I want to mention about this location parameter is this is the location to the your startup file, you will get it via file manager, as you cannot run typescript code directly here, you have to convert it into javascript using tsc command and further target dist folder using location parameter in vconfig file
Now next question is how to run application outside console ?
Create a website to deploy the project, use below link for reference click here
Issuing SSL for website - link for reference
This is my folder structure for deployment, simply zip all files and upload it on file manager of cyber panel, and extract out your files. You can see, I have dist folder which contains all javascript files and also have index.js, the main startup file.
Click on fix permissions on file manager.
Go to Web terminal and install node modules. how ?
on web terminal :- type cd .. and press enter.
There you have to find out your project from directory, You can use ls command to get list of files and folder structure.
mine directory was (after using cd ..) :- cd home/FOLDERNAME/public_html
At last run your project through terminal, to check its working.
Config your vhost config file, below is reference image
File you have to add in vhost config, I also had provided you above.
If you domain is setup correctly, you can view on api on your domain else you can click on preview button on cyber panel
Note :- Always Run code in terminal first to check its working.
I am running a webserver on linux Centos7. It is located at local IP address 192.168.1.100.
Further, I have a Windows server running on the same network, at local IP address 192.168.1.200.
I need my users to be able to create a directory on the Windows server via the webpages on my webserver.
However, because the webserver is linux OS, it cannot(?) create a folder directory on the windows server, despite adding ALL read/write permissions on the Windows server.
For example, on the click of a JS button on the webpage, I would want php to mkdir at 192.168.1.100/thisdirectory.
Is there a way in php to do this? Do I need to mount the windows drive on the linux server, and then use php to mkdir to the symbolic link?
I am currently using javascript & ActiveX to use the client's machine to create the windows directory - but this is not ideal.
Any thoughts on how best to do this?
Thanks,
Mat
I am having a React project in WebStorm in my machine. I want to run it from another machine. I don't want to transfer the project file as it will cause dependency problems (dependencies which are installed in my machine in WebStorm). I want to have something like a build file which can run on another pc.
How can I do it?
Let the machine you wish to use connect with your machine with code in local network.
Open the Run/Debug Configurations dialog. Enter JavaScript Debug. Click "Share" to switch on the share function.
Get the url that you debug on your machine. like
localhost:63342/cocos2d-html5-v2.2.3/myproject/index.html
replace 'localhost' by your local network ip address. like
192.168.199.160:63342/cocos2d-html5-v2.2.3/myproject/index.html
use the url above to access to your project.
I have an folder say 'mywebapp' on windows machines. This folder has index.html page, js directory with java script files and css directory with css files.
Now when i open this index.html into browser, the browser displays contents pretty well, as if i have deployed this application on server, which is not the case.
Now i wanted to do same on my Linux machine vm, login-ed through putty. I tried using pythons SimpleHTTPServer which gave me same result. But as soon as i exit from putty session, the webpage doesnt display. seems like SimpleHTTPServer server connection is broken once i exit the putty session.
Please help me.
Or any other professional and easy way to get my webpage displayed. Tomcat seems good option but i don't have root permission and don't want hectic deployment process.
I heard about node.js, but i don't have root permission to install node.
Most simplest way i can suggest it to download and copy tar.gz file from location:
https://tomcat.apache.org/download-70.cgi
1 then gunzip and untar this downloaded file.
2 Go to conf/Catelina/localhost folder.
3 create an xml with your application name, e.g. mywebapp.xml
and put following to this file:
<Context path="/mywebapp" reloadable="false" docBase="<root-path of your application folder>"/>
here "root-path of your application folder" will be the root folder of ypur HTML, js and css files.
Then just start this tomcat using /bin/startup.sh command and check on browser using localhost:8080/mywebapp
I have two servers: Server 1 and Server 2
My application is installed on Server 1. Server 2 contains some .PDF files.
I have created a Shared Drive.
Via UNC path, I am able to open PDF files folder from Server 1 as below:
\\Server2\Files\a.pdf
This UNC path I want to use when I want to open PDF files in a new browser window using javascript.
I tried using:
window.open("\\Server2\Files\a.pdf")
this is not working.
I also tried:
window.open("file://Server2/Files/a.pdf")
this is also not opening file nor giving error.
How to use UNC path to open file from Server 2?