Enable HTTPS on php application served by httpd - php

We have an existing PHP web application served by httpd and my current responsibility is enabling HTTPS on that application. (I am not a PHP guy). I already have the signed certificates ready (.pem). Most tutorials I've read in enabling HTTPS assumes that I have some cPanel where I can install the certificates. In our case, the app is actually served by httpd installed in an AWS EC2 instance (RedHat Linux, I suppose). So my question is:
(1) In which part do I enable the HTTPS, in the httpd configuration or in the application's PHP code? Or both? What should I change?
(2) I understand that the standard port for HTTPS is 443. That port is non-existent based on our network ingress rules. Can we change the standard HTTPS port other than 443 and how?

I don't know anything about aws, but I can answer your two concrete questions:
Php does not serve websites through http or https. You have to enable https in the webserver. The webserver then calls php to execute the code and returns the result via http or https.
HTTPS port should always be 443, otherwise the user has to enter the port when connecting to your website
http://example.com -> port 80
https://example.com -> port 443
https://example.com:1234 -> port 1234

Related

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.

Apache reverse proxy for video streaming

I am new to Apache.
I have a situation in which my server PC is connected to both WiFi as well as wired(Ethernet) network.
The situation is displayed in following image.(image is in pastebin)
Mynetwork architecture
I am able to watch HTTP stream from the IP camera in my server PC (same subnet).
But how can I create a webpage (hosted in my server PC) from which users from the userpc should be able to watch stream from the IP cameras.
Is it possible to use Apache reverse proxy to solve this issue?
Yes, in this scenario deploying Apache as reverse proxy in server PC can solve the issue. Following steps need be done to setup Apache as reverse proxy:
Enable mod_proxy and mod_proxy_http Apache modules
Set 'ProxyPass' directive as below
ProxyPass <Path-accessed-from-userPC> <URL-to-access-HTTP-stream-at-serverPC>

server running IIS and Apache: setting up SSL

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!

Application tool to perform cross browser testing within localhost

I am in the middle of building a website which means it is not uploaded to a server yet. Is there any way I can perform cross browser testing from the localhost and not an actual hosted URL?
Either by running lots of browsers natively (some in a VM), or by using SSH tunnelling to a commercial service like browserling (http://browserling.com/).
Edit to elaborate a bit: An SSH tunnel (a reverse tunnel technically) between your localhost and a server allows you to forward certain ports on the remote host to ports on your localhost, over an encrypted SSH channel. This means the browsers running on browserling's servers can send packets down the tunnel, back to your localhost and your webserver there.
Install PHP on your local machine, this way you can run PHP scripts in command-line or browsers.
http://php.net/manual/en/install.php
Configure your webserver to listen on your network IP and access your website through IP address on your local network.
If it is apache webserver It would be configured using directive:
Listen IP:port
Example 1 (your adapter IP address):
Listen 192.168.1.10:80
Example 2 (global listening on all interfaces) - better for testing
Listen 0.0.0.0:80
Then just simply access your computer from other browsers on other platforms.
Sure. If you're able to configure your local network you could expose port 80 or 443 to the cloud by making changes to your routers firewall. This would make your application as available for testing locally as any on a remote host.
Let me know if your question is about which tools you could use, either as external services or locally installable.

Categories