Can run Angular app from local computer but not from local server - angularjs

I can start and run my Angular app fine from my local computer. But I have never run it on a server before.
I have tried uploading it to the server. On the server I type the following to start it:
http-server
Then I visit http://serverip:8080/. Instead of seeing my app I see:
Index of /
(-rw-rw-r--) 847B app.js
(-rw-rw-r--) 748B index.htm
Node.js v0.10.25/ ecstatic server running # 195.189.182.160:8080
What is missing in my configuration?

ecstatic is a static file server. It's not set up to be a web server by default, even though it can work that way. When you do run it as a web server, certain standard options in most web servers - like treating a request for /path/ as a request for /path/index.htm - are disabled by default.
You need to enable opts.autoIndex. The package readme tells you how to do that. In your case, it means editing http-server or the .js file that it fires off; it's hard to say from what you have posted.

Related

Django+React AWS LightSails Ubuntu deployment not using js

this is my first deployment, I have gone so far as to create and configure Ubuntu instance on lightsails following official guide. However, I run into problems when instead of an empty project I use my own Django hosting React frontend.
My project works on my computer and if I start up django's production server thorugh manage.py runserver but does not run at all if I use gunicorn to run it with:
gunicorn my_app.wsgi --bind 0.0.0.0:8000 --workers 4
It seems that it cannot find proper filepaths of any static files but I do not undertstand how to configure it to use it since Django already has all the right paths.
One of the errors in the browser console:
Refused to execute http://3.127.76.103/static/rest_framework/js/bootstrap.min.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
How can I start fixing it, I do not understand why it does not see the any files.

How to see console.logs of a running nodeJs application on ubuntu 18 EC2 instance?

I am new to the node world. I created a node js rest API. When I run npm start in my local machine or in the terminal for the first time, I can see console.log() in my terminal. Now, I am running the same application on an AWS Ec2 instance with Ubuntu as os. I run npm start and serve my app on port 80. I do this via ssh and after running my server I close the ssh connection. But when I reconnect via ssh, I want to see those console.log() messages in my terminal for some purpose.
I completely understand that logging messages in the terminal is not a good idea and there can be so many alternatives. Just want to know how to access the same terminal window/result as we see when I start my application.
if you are using pm2, you can try "pm2 logs"
So Nodemon won't work well in a production server or in any instance where you need to have the app going by itself.
Nodemon is a dev tool to enable you to restart your server during development. In a "real" vps you need to place the process in the background or it will be automatically killed when the connection times out.
Check out this YT series for a correct deploy architecture in an NGINX server with the use of pm2 and NGINX on a Red Hat server, I've personally used it more than once:
https://www.youtube.com/playlist?list=PLQlWzK5tU-gDyxC1JTpyC2avvJlt3hrIh

Can't connect to localhost:8080 when trying to run Google App Engine program

I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs:
Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7
When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both.
How can I view Hello World in a browser? Is there some configuration I need to make on my machine?
I had the same problem. This seemed to fix it:
cd to google_appengine, run
python dev_appserver.py --port=8080 --host=127.0.0.1 /path/to/application
at this point there is a prompt to allow updates on running, I said Yes.
At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.
I have to manually start python and make it point to my app folder, for instance in a command line window on Windows I am using python. I installed python in C:\Python27 and my sample app is in c:\GoogleApps\guestbook
C:\Python27>dev_appserver.py c:\GoogleApps\guestbook
and then I can start my app in the Google App Engine Launcher and hit localhost 8080
How about specifying --host argument? You can find it at the bottom of following doc.
https://developers.google.com/appengine/docs/python/tools/devserver
This might be a little late. But still someone might find it useful.
When ever you go and try changing the port number from 8080 to something else, it will not get updated. So the best option is:
Go to your user directory: eg: C:\Username
There will be a Google folder. Go inside
Open the file google_appengine_projects.ini
Change your port number from 8080 to whatever you like 8081
Save it and close the file.
Launch the GAE Launcher again and you will find the changes reflected and the app runs without issues.
7: Access the application using: http://localhost:NewPort/
This can be used to change ports both run port and admin port for your individual projects running locally.
Hope this helps!
The 8080 portion of your url is a port number. Firefox disables visiting url's of other ports by default. You have to enable them by doing the following: http://blog.christoffer.me/post/2012-02-20-how-to-remove-firefoxs-this-address-is-restricted/
Paraphrasing that website:
Open firefox and visit about:conf
In the Filter box, type in network.security.ports.banned.override
If you can't find such a preference, right click to open up the pop-up menu and pick New and then String
As preference name type network.security.ports.banned.override and 8080 as the value.
Done!
It's likely if this continues to not work that your browser is behaving properly (8080 is a fairly standard port). That means that its a problem with the server and we'd have to do some more debugging.

deploying gae to development server stopped working

I'm working through a test GAE Java project which was working fine but I decided to look at adding GWT to the same project. I then decided to stick with the GAE stuff I was learning and decided to remove GWT. The problem is I can't now deploy to the development server as it gives the following in the Eclipse console pane. Anyone know please how I can reset appropriate settings to how my project had them originally?
terminated test [Web Application] C:\Program
Files\Java\jdk1.6.0_37\bin\javaw.exe Usage:
[options]
Options: --help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest -s SERVER SDK version. --address=ADDRESS The address of the interface on the local machine -a ADDRESS
to bind to (or 0.0.0.0 for all interfaces). --port=PORT
The port number to bind to on the local machine. -p PORT
--sdk_root=DIR Overrides where the SDK is located. --disable_update_check Disable the check for newer SDK versions. --generated_dir=DIR Set the directory where generated files are created. --jvm_flag=FLAG Pass FLAG as a JVM argument. May
be repeated to
supply multiple flags.
I seem to have found my own answer through setting up a new dummy gae project and having a poke around, found that the 'Run As' > 'Run Configurations...' > '(x)= Arguments' > 'Program arguments' had an additional port defined prior to the rest of the argument beginning '--port=8888'. I removed the mention of '-codeServerPort 9997 ' and it now deploys to dev server and appears to be working as before.
eg
new dummy project: --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\dummy\war"
project that wouldn't deploy to dev server: -codeServerPort 9997 --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\test\war"
I faced the same issue and you know what, Workaround is just pretty simple.
I created one new appengine project with only one jsp in WAR and 'Run As' > 'Run Configurations...' >Server Tab -> Unchecked then checked Run Built-In server and then checked Automatically select any port.
Server started ..on some fishy 25334 port..i stopped that using red button on Console Terminal.
then i changed it back to 8888 and WHOA project Ran.... :)
Then i did the same with old project. deleted this new one and all is working as expected.

Starting up tomcat-6.0.20 from eclipse-3.5.0 (galileo) leads to the 404 error

Console dogs me. Can anybody help?
The sad story starts like this. My OS is ubuntu-9.04. I installed tomcat-6.0.20 by extracting it from .tar.gz package and put it under the /usr/share/tomcat-6.020 directory.
Then I started tomcat from console, and everything seemed to be fine. localhost answered with the $CATALINA_HOME/webapps/ROOT/index.html page.
The next step was to put my tomcat in the eclipse's servers list. So, I went to Preferences > Server > Runtime Environment > Add > Apache Tomcat v6.0 (here I also browsed to my tomcat and changed JVM from JRE to JDK). Finally, I added my server to the Servers list.
So, having everything configured, I started my tomcat from the eclipse, opened a browser and asked for localhost. 404 all over sudden. Despite the fact that the eclipse's console has shown no errors.
Has anybody encountered the same problem?
I fixed the "Could not load server configuration" problem by deleting the current server configuration from the Servers View and adding it again.
Open your Tomcat settings (double click or F3 on your Tomcat instance in 'Servers' view in Eclipse):
Make sure configuration path is valid and configuration is valid
Click on modules tab and make sure your app is deployed.
I'm with Carlisg. I had this error in Eclipse 3.6 with Tomcat 5.5: "Could not load server configuration at /Servers/Tomcat v5.5 server. The configuration maybe corrupt or incomplete." After playing around with every setting for 20 minutes and getting the same error, I just deleted the server, re-added it and it worked in about 90 seconds with no changes.
yes emanemos is right, I tried it today and got it working instantly. Create a new project in eclipse, I created a Dynamic web project. Create a new server, choose your apache version as the server type. Then create your pages and resources in this project space. I created index.html in Webcontent and pointed to http://localhost:8080/trial/ and I can see my index.html. (trial is the name of my project).
In windows vista 32 I fixed like this, In 'serverlocation' selected Use Tomcat installation(takes control of tomcat installation) and for deploy path I added my tomcat webapp dir.'C:\apache-tocat-6.0.26-windows-x86\apache-tomcat-6.0.26\webapps'. With default configuration path /Servers/Tomcat v6.0 Server at localhost-config, it just works fine.
I had the same problem and solved it following these steps:
On the Server View, right click on the server (Tomcat 6.0 Server at Localhost)
in the menu options click "Open", this opens a menu with all the configurations for the server.
On tab "Server Locations" you must select the option "Use Tomcat Installation (takes control of tomcat installation)".
Do not forget to check the Deploy path.
I think there is a problem with eclipse configuration over Tomcat and it must use the tomcat installation configuration.

Resources