How to connect WAMP to Google SQL with Cloud Proxy - wamp

On our development server and test linux boxes, we have been using Google SQL with Cloud Proxy for connections. Everything is working just fine.
However, I need to setup a couple users with WAMP. (Windows 10 64bit Apache, PHP 7). I am not very familiar with WAMP. We have everything working except Cloud Proxy.
On our Linux boxes we have the socket setup in its own folder (under root) /cloudsql.
What is the equivalent location on WAMP? (We don't want to have to maintain different configuration files just for one or two WAMP boxes).

On Windows, you must use TCP sockets. The documentation can be found here:
https://cloud.google.com/sql/docs/mysql/connect-external-app#6_start_the_proxy
Specifically you must tell the proxy the instance name and the local port on which to listen for connections for that instance:
cloud_sql_proxy.exe -instances=<INSTANCE_CONNECTION_NAME>=tcp:3306

Related

QT Creator https request not working on VM

I am working on a small Application in Qt with C++.
(This Application is meant to run on Windows)
I am sending a few https requests in this App and recieving answers from an API.
This works fine. But on Vm with Windows 10 Enterprise 21H1 Image I cant get a connection to the Api. Installing Open SSL on the VM is not an option.
What else could I do, to get it working on the VM?

How to manage/combine multiple servers on single machine?

TLDR:
Would a "real server" (Apache? Flask? Django?) be able to unify various services behind readable subdirectories (abc.work.com/svn, abc.work.com/hg) instead of using port numbers (abc.work.com:8000, abs.work.com:8001)?
Long Version:
In the last year I've learned how to serve files with Mongoose, run a minimal python webserver, host version control repositories with Subversion and Mercurial, and host a Trac issue tracker/project management framework.
In each case I've been using the easy built-in webserver provided by each tool to host it from my Windows 7 laptop at work (I'm an engineer who codes, not actually paid to be a "software guy"). In order to avoid clashing I've used different port numbers in the 8000 range for each server to listen on, and sent my coworkers links like http://machinename.domain.com:8042 to access these magical things I've created.
The first obvious problem is that I'm running a lot of these things out of a command prompt and just letting it sit open on my desktop. I also know how to call cmd.exe from VBScript in order to hide the command prompt if that's all I wanted. Many of the built-in webservers even have options to run as a service, which can get harry with permissions, but is closer to the "right" way to host a server of any kind.
The bigger problem is that I'm sending people links to my machine with different port numbers. I'm ok with them having to use my machine name - I assume I'd need the network admin folks to add a DNS entry to call it TeamAwesome.company.com instead of machinename.company.com:8000?
The bigger question is, if I did something fancy like an Apache, Django, or Flask webserver, could I set it up like machinename.company.com/trac for the trac server and machinename.company.com/hg/project1 for the HG repository for project1? I'm looking at Apache, Django, and Flask because I've been diving into Python for 2 years now and those appear the most applicable/approachable for my needs.
I understand that ideally this stuff should be hosted on a separate linux-y server machine, but I'll need to prove the usefulness of the tools I'm developing before I request server resources from my boss (who hired me to do engineering, not programming, or web development, or systems administration, etc.).
I see this looks related. Are http proxies, virtual hosts, nginx, and WebSockets things to look at?
Looking at Apache VirtualHost examples looks promising though I can't decipher if one of those examples actually does what I'm talking about. Thanks for any suggestions as I go further down the rabbit hole with this stuff!
Apache virtual hosts can be differentiated by listening ip and/or port number only.
The mod_proxy module can do what you want if you want/have those services to be running separately as well:
ProxyRequests Off
<Proxy *>
Allow from all
</Proxy>
ProxyPass /folder_a http://backend_a:1234/ retry=5
ProxyPass /folder_b http://backend_b:8888/ retry=5
# etc
However if you just want to point different urls to point to unrelated folders on your server then check the Location and Alias directives
No need for proxy settings. You can use a single virtual server, but run each application under a certain subdirectory: for example, with Django or another wsgi app, you would simply set WSGIScriptAlias to the relevant dir.
A big clarification, though: Django is not in any way a server. In fact, you need Apache or an equivalent in order to serve Django properly.

Test a webservice on a different port locally without JSONP

I'm currently writing a webservice (with node.js) for an AngularJS frontend which is hosted with node.js
It will later be available through a proxy under domain.com/api and therefore I don't need JSONP.
For local testing purposes i have my AngularJS app running on localhost:80 and my node.js backend on localhost:3000. Naturally I'm not able to query json requests. The easies
What would be the best setup to test my homepage locally without screwing to much in my setup?
I'm currently working on windows. Linux is also an option if it is easier.
Would it be possible to write a simple proxy for express that hosts both apps in the same domain?
You can use the hosts file to set the domain.com/api to localhost. This is done in /etc/hosts in Linux, but its present somewhere in Windows too. Another thing that helps me a lot is ssh tunneling. You can, for example, tunnel remote ports (where your backend is running) to localhost with ssh -L localPort:your.server:remotePort
It's not exactly what you asked for, but the easiest might be to have the node.js app serve the AngularJS app, too. It's quite efficient, certainly efficient enough to use for development.
If it's an expressjs app, you can just add
app.use(express['static'](__dirname + "/public"));
before your other routes to have it look for static files in ./public/
If your app is served by a template or build system that you can't easily reproduce in node.js, then another option would be to run nginx, apache or haproxy on some port (80 or 5000 or ...) and have that proxy to the current backend server for the app and port 3000 (the node.js app) for the API/data requests.
You might even be able to have your server currently running on port 80 do this.
As a final idea you could also setup the node.js app to proxy to port 80 for the "app files".
Edit - I just realized that both of your apps are written in node.js. Would it be possible to set it up so you run them separately in production but together in development? Put all the real functionality in modules and then have three separate "loaders" that start the apps, one together and then a loader for each individually.

How do I implement port redirecting/mapping on windows?

I am programming a web proxy that is installed on client machines (same machine as the web browser).
I would like for all traffic that is web traffic to get redirected into my proxy server.
I am using a windows operating system (XP, Windows 2003, Windows 2008, Vista, Windows 7).
What would I need to do, to redirect all internet traffic on port 80 to my web proxy?
I noticed this software allows you to create port mappings in windows. And I can get my proxy to work in that way. One of the components they install is called NDIS and I assume they use that technology to be able to port redirect.
So my question is... what is the best (best as in easiest to implement) API or technology to use to program a port redirector in Windows?
Your options are Application Layer Proxy (= browser proxy settings), Layered Service Provider; TDI driver (or more modern equivalent?); NDIS driver. There is no simple answer to what is best or easiest. You need to take your own skill set into account, as well as the potential compatibility issues. Lots of other programs use each of these methods and you need to be compatible with them, or at least not break them.

How do you debug Django sites using Win 7 XP Mode?

I am developing a Django site using Windows 7 as my dev environment. I have IE6 running through XP mode. Accessing my site through localhost:8000 doesn't work in IE6 (probably since it is still running a VM). Is there a way to access my site in IE6 while it is being served through Django's test server running on Windows 7?
When running the Django runserver on one machine ,but accessing it from another (or Virtual Machine in your case), be sure to:
a) Have the django test server bind to an address that IE6 in the VM can access. To do this, run the server with:
$ python manage.py runserver 192.168.x.x:8000
b) Visit that explicit address and port in IE. For IE6, be sure to specify the 'http' protocol as IE6 doesn't like IP addresses without a protocol:
http://192.168.x.x:8000/
The reason for this is that, inside the VM, localhost or 127.0.0.1 (the defaults for runserver) refer to the virtual machine's IP address space. If using IE6 to test, you want to refer to the host OS, so use an absolute IP address that the client VM can address. There is some documentation on this from the django project, and rest assured this is a common enough need that we all do it - testing multiple variants of IE in a virtual machine seems to be a fact of life :-)
If you are still having troubles, be sure you have determined whether you're using NAT or bridged networking for your client VM as this controls the IP address, OS firewall restrictions (if any), and other avenues for communicating between a VM client and host.
your VM and the server running django are in two separate containers, and you can't access django app using localhost since Django is not installed on the VM. but what you can do is install IE tester http://www.my-debugbar.com/wiki/IETester/HomePage] in windows 7 to test all versions of IE.