Setting up angular project with puphpet, creating a virtual host - angularjs

I recently started using VM's for development but I lack skills on setting up virtual hosts and using apache/nginx.
So I have a project now in two parts. Backend is created with Laravel and frontend with AngularJS. I'm using Apache in my VM.
I managed to set up virtual host for the backend with no problems. Now I'm having troubles on setting up a virtual host for AngularJS. I know I can run it with gulp serve, which in my case hosts it at localhost:9001. But that means I can access it in my virtual machine with that url. How can I access it from my machine? If my virtual machine url is 192.168.56.101, shouldn't I be able to access it from 192.168.56.101:9001? Right now it just says:
This site can’t be reached
192.168.56.101 took too long to respond.

You probably need to open up the port in the firewall section.

Related

Unable to access front end after building aws ec2 application -- refuses to connect

I have set up an AWS EC2 linux 2 instance that uses react created through github. I have successfully been able to build the application, but when I open the website it tells me that it refuses to connect. I have seen several discussions about this that talk about ensuring the web server is enabled and running (that has been done). If I try to open the link directly from my instance in AWS using the public ip. It seems either a port is not opened correctly (I have them opened in the SG of the instance) or something is not linked correctly. The application was running fine until I stopped and started it causing it to change the ip. I have not been able to find anywhere, if it matters, where that would be defined.
Thanks,
Jeremy

How to call my API in XAMPP when this server has an IP different than localhost?

I installed the new XAMPP 7.4 in macOS Catalina and the window is very different than before. I press Mount and it runs. But I have Angularjs projects that calls API Rest Laravel projects in htdocs, but doesn't work because it calls to localhost or to the local IP of the computer, but I don't know how XAMPP works now.
XAMPP creates a new ip where is htdocs and I access to the folder throw the IP but my Angularjs projects can't access because they don't know the IP, only call to 127.0.0.1.
How can I configure XAMPP to work with localhost or how can I configure Angularjs to call to that IP without affect my production server?
Thank you!
Disclaimer: I have not done this before, my answer is based on my angularjs experience and a brief search.
Trying a brand new project
In this article (which you have probably already seen and tried): https://kode-blog.io/angularjs-install-and-configure there is a very relevant segment, namely Step 1: "You can directly create the folder angular-js in drive C:\xampp\htdocs". I understand your issues is just vaguely related, though you could try following this article step-by-step with a brand new project
XAMPP to local/virtual host
If I understood correctly you are looking for a way to modify the XAMPP/AngularJS serving to the same IP. Let's try setting XAMPP to localhost first:
Setting up a virtual host on XAMPP on Mac or How to set xampp open localhost:8080 instead of just localhost and also more detailed, step-by-step ones: https://jonathannicol.com/blog/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/
Serving AngularJS to a specific host
AngularJS is a lot less flexible than Angular 2+ (Set default host and port for ng serve in config file) when it comes to serving a host. You could try using http-server and node.js (first answer here: How to create a localhost server to run an AngularJS project but also check out other answers, there is some extra useful info there)
Extra bits
What you are trying seems to be absolutely feasible and done by others (Setup AngularJS and NodeJS on Xampp Web server or https://www.quora.com/Can-we-use-AngularJS-in-XAMPP) but it's not the most common thing.
I know that this answer does not directly give you an easy-to-implement-one-single-line-of-wondercode, but I hope it will start discussion at least and result in something more useful.
To use a Status IP like localhost:8080, you have to go to the Network tab in XAMPP and press Enable on the localhost:8080 option. I feel ashamed for taking too long to find this. Thank you.

Open local website on computer from phone on same network

I have a local sandbox website on my computer running on nginx. I have chrome canary and that's what I"ve been using to test the various media sizes. Of course, this doesn't stack up against actual hands-on testing to get an idea of the feel of the website.
So, is there a way to be able to access a website running on my computer from the same network? Even if I have to use a specific app. I would like to use the same URL. dev.mywebsite.com and mywebsite.com run a on a server, sandbox.mywebsite.com is on my machine (this is the one I would like to access). I don't need to access to it remotely, just when I'm on my network is fine.
Note: I need to use the actual URL.
Thanks.
If sandbox.mywebsite.com maps to localhost on your computer, then by mapping sandbox.mywebsite.com in the hosts file of your phone to the local network IP address of your computer e.g. 192.168.1.9, you should be able to access it on the phone.
I have done this using android with hosts editor, connecting to apache running on an ubuntu laptop.
There are also many google results for this, so you may be able to find something there for your specific configuration.

Access a website globally which is running nicely in LAN

I have developed an application (website) which is running in LAN nicely.
My application is built using Silverlight and I have published that website in IIS and I can access that application nicely in LAN through following LINK.
http://192.168.137.24/SilverLightBusinessApplicationWeb/SilverLightBusinessApplicationTestPage.html#/Home
Now I require to access that application globally all over the word from any PC through INTERNET so for that, what configuration I have to use?
You may want to redirect your port 80 to LAN IP via router/modem settings.

Silverlight app - service URL cannot handle IP address

I have a Silverlight app that run on a single server which also hosts the web service used for data access. This is a Service Reference in the project. A common issue is that someone browses to the app using an IP address rather than the machine name. This breaks because the app thinks this is a cross-site violation.
To access the web service we create a System.ServiceModel.ClientBase and assign is an address in the web.config file. So locally in dev this is localhost:xxxx, and in production is it the machine name. Or we could set it to the IP address, but then everyone would have to go to the app using IP address only.
Is there a good way to do this? One issue is that some people access the app internally where the machine has a good name, while others access it through a VPN where they may need to use IP. I would like for both to work.
FYI I had this same issue. silverlight application and wcf service running on same server, but when application is started using an ip address vs. application url, then cross domain problems occur. evidently these urls/ips are not resolved/matched locally so to the silverlight application, they look like different domains. My app is running as an application and couldn't be moved to root of iis web site for technical reasons which is required for a clientaccesspolicy.xml file or crossdomain.xml to work properly.
I solved it by adding an entry into the hosts file on the server with the ip address and name of the domain. This looks a bit strange since we are on the server pointed to by the ip address and the domain/machine name but it works.
Adding this locally in the hosts file evidently redirects all requests for the ip address to the server PRIOR TO making either the call to get the silverlight application or the call the wcf service, so they look the same no matter whether the application or the service is called using an ip address.
Hope this helps anyone else in the future.
FYI - this does not work with VMs
We use VMs for some functionality and I have found this just doesn't work when running clients from the VM. The VM manager must do something to the request before passing it through. Just thought I'd mention this for future use.
Have you tried creating a clientaccesspolicy.xml file?
http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx

Resources