server running IIS and Apache: setting up SSL - php

One of my clients have a server running both IIS and Apache. IIS is on port 80 and Apache is on port 8081. I am working on an application that will be running on Apache and this application needs to be configure so that it uses SSL.
The client already purchased the SSL certificate from Godaddy but when trying to generate the CSR file, it asks for certain information like the Common Name (fully qualified domain name, or URL, you are securing. I am having from with this particular section: Common Name.
The application's URL is http://apps.patria.com.do:8081/Cobros_Online/. When I use this as the URL, it tells me it is not valid. After doing some research, it looks like it cannot contain port number. How can I fix this? I can't use the default port 80 because IIS is on port 80.
So, for example, http://apps.patria.com.do/, will take you to another application running on IIS.
What can I do to make the URL acceptable?
Thanks in advance!

Related

How to run both Microsoft IIS and WAMP on the same PC via localhost

I have recently enabled IIS by going to the Add/Remove Programs option in the Windows Control Panel and enabled IIS via the “Turn Windows features on or off” checklist.
I also want to install PHP for Windows on the same laptop and have downloaded XAMPP but I have yet to actually install it. Is it possible to do this and run them both from http://localhost/ - or is that not possible?
If so, great stuff... but if not, can you please give me some helpful pointers on how to achieve both IIS and PHP/MySQL running locally from the same PC?
You can have multiple servers on one physical machine, but you can only have one server running on one port. The default HTTP port is 80 and the default HTTPS port is 443. If IIS is running on 80 & 443, then WAMP will have to run on another port, and vice-versa. To access web servers on another port, you use the address http://localhost:PORT.
To change the ports of either web server see these questions:
How to change port number for apache in WAMP
How do I Change IIS Express 8 port 80 to 8080
In theory, it is possible to run two different web servers in the same machine. The only trick you need to consider for this is adjusting the reach points which are ports.
So the answer of your question is both yes and no. You can run them together in your localhost but if you want to access them both from http://localhost/ it is not possible. you need to provide the ports they've using to do that like http://localhost:5000/
To achieve this, you just need to adjust some settings files in your XAMMP etc. Change the default port and it should work.

How to setup and run a PHP WebSocket service on a cpanel-based shared hosting platform?

I have created a Chat application in Ratchet PHP. It runs fine on local machine using WAMP. I want it to setup on live server.
On my server I have:
PHP Support
SSH access
Port 9000, which is opened for OutBound connections.
Sub-domains
What I don't have:
No port for InBound connections.
No root access in SSH. Say I cannot see/edit iptables
I ran php server.php which gives success message about the server is started and listening at port 9000. But when a HTML page tries to connect it using ws://domain:9000 it runs into error-
Firefox can’t establish a connection to the server at
ws://domain.com:9000/
I googled a lot and it appears that what I need is a port for inbound connections.
But according to this answer the thing I need is PHP support for Ratchet to work on shared hostings. Can anyone explains what I really need and Is there any workaround If it's not availble in the list of things I have on my server.
Basically, No
It is not likely for a shared hosting environment (i.e. Apache with VirtualHost config, PHP, MySQL, and a CPanel interface) to support your websocket application.
For websocket to work, you need to either:
have a port dedicated to websocket in-bound connections; or
have a HTTP/HTTPS server that knows when to upgrade a connection and proxy pass to your websocket application.
The first route requires the server to allow in-bound connection to a certain port number. This is a potential security issue for the hosting provider and, thus, is unlikely for your vendor to grant you that.
The second route requires Apache server have with both mod_proxy and mod_proxy_wstunnel installed and enabled. It also require you to use ProxyPass config, which cannot be overridden by .htaccess configs at all.
So unless your hosting grants you the permission to touch the Apache main configuration (or would apply such change for you), you're pretty hopeless.
Suggestion
To run your own websocket service, you should think about using Virtual Private Server services such as Amazon EC2, DigitalOcean VPS.

Can I have a subdomain of php application on asp.net application

I have an asp.net web application hosted and I would like to add a sub-domain (or sub-directory) and run/host a php application in it.
How would i do this?
A subdomain would be nicer from a technical standpoint:
You could make your DNS route the subdomain.yourdomain.com to a different Server then yourdomain.com
You could add different IIS bindings for subdomain.yourdomain.com and yourdomain.com in IIS.
For a sub-directory you'd have to run php in IIS as well, here is a guide in how to set it up: You can also run an php website in iis.
You could also run php on Apache and dotnet in IIS. The only downside: If you try to run both apps on 1 server, only 1 (IIS or apache) Can listen for http traffic on port 80 (the default port). so you'd have to host 1 on a different port (eg for port 81: yourdomain.com:81) which i wouldn't advice for a production website.
You could make a tiny application which receives every request and forwards the http request to the right application on a different port. This is called a reverse proxy.

Use local apache API from Laravel

I have developed an API which is available locally on loc.api and on production on live.api (obviously the domains are just an example).
The API runs locally on a classic apache server.
Now I am playing with Laravel, using this API. No problem connecting to live.api (as I am using the real domain), but fails to connect to my local API.
I am guessing it is just a host config issue, as Homestead fails to connect to my normal apache server on my cumputer.
If that is the case, I should just have to define an IP linked to loc.api, but I have no idea what IP I should use there.
So to recapitulate, no problem running loc.api on my local apache server, no problem running live.api, no problem running Laravel on its own or connected to live.api, but can't seem to get Laravel to work with my loc.api
Any ideas ?
Homestead runs on something akin to a virtual machine. The virtual machine's localhost is indeed the local IP address used internally within the virtual machine. In order to communicate with the host machine (the machine running the virtual machine) you need to use the default gateway IP address. This is the IP address which the virtual machine uses to refer to its host system.
The default varies depending on the configuration of the virtual machine. Ideally, if you've setup your API normally on your localhost and access it locally via 127.0.0.1 (or localhost) then setting your local site configuration to the default gateway will work.
However, if you set up your API through a virtual host and you access it via local.api or some host like this you need to modify your virtual machine's /etc/hosts file (since homestead is serving an Ubuntu OS) and enter a line like
<gateway IP> local.api
This way you can use local.api as your API host address which will resolve to the gateway IP and call the API using the correct hostname.

LAMP stack on home computer as a public web server

So I'm using this website:
http://www.howtoforge.com/ubuntu_debian_lamp_server
to setup LAMP on my Ubuntu Virtual Machine.
Here is my question though,
This will enable me to program and test through localhost. How can I set this up so anyone on the web can access my .php pages from any Internet capable device, and they will still interact with my local database, etc?
If you open port 80 in your firewall to your local machine, it should be available to the outside world via your ip address. You will need to check your router settings to figure out how to do this, but usually it's called port forwarding.
You could then use a free service like dyndns to give yourself a domain name that you can then type into your browser such as
myserver.dyndns.org
You have a couple of options...
1) Find a site that hosts LAMP and put you site up there. Many of them allow you to register a domain name and they manage the machine.
2) Do what Ben Rowe suggested, use a DNS forwarding service (Some are free, some not). Host the site on your own machine, some ISPs do not allow you to use port 80, you might need to use another port.

Categories