Deploy SSL-enabled website to WHM-managed VPS - php

I've built a website (PHP5, HTML5, CSS3, node.js, MySQL 5) that works fine - it requires SSL - I coded it to reload users with https if they're not already using it. I have deployed this site successfully to many linux servers before - I know how to do that but - I need to deploy this to a VPS that has WHM on it.
I studied WHM. What i've done so far at a high level:
added an account for say xyz - with shell access
ssh/ftp into that account using the ip-address of the VPS
install code in /home/xyz/public_html with 755/644 permissions
built a custom php.ini in /home/xyz/public_html with needed settings
mysql -u root - set root password and added database/user xyz and grant all on xyz to user xyz
MySQL Workbench into the VPS using SSL user xyz - set up database xyz
pointed the xyz domain at the IP address of the VPS
The website works for http but for https all I get is 404 Not Found. I expect it's looking in the directory where WHM is installed for those assets. I cannot see the apache logs to confirm this.
From what I know about SSL you can only have 1 website on a server that uses SSL. WHM is the one website on this server that is already using SSL.
This dawned on me - a duh moment when I got my first 404.
I've searched everywhere and found nothing - what i've managed to guess so far is that I will have to do this thru WHM - I need to:
add an IP-address in WHM - I see where to do that but do I just make one up? do I have to call GoDaddy and get them to give me one? or buy one?
move my xyz account to that IP address in WHM - I see where to do that
and then somehow get DNS servers to go to that IP instead of the IP of the VPS. This is where it gets over my head
I've searched for days and all I can find anywhere is tons of articles on installing SSL certificates. I'll get to that point eventually but for now I just want my website to work. Am I moving in the right direction?
I apologize for the long question I'm trying to demonstrate that I have researched this and tried everything I know. Thanks.

Usually, in a WHM server, the logs for a domain/s are located in the /usr/local/apache/domlogs directory. Check those.
Generic error logs for Apache are in the /usr/local/apache/logs/ dir.
With WHM you can install SSL certificates as much as you want. It has SNI enabled by default.
I cannot guess what your problem is without access, so you should start with your log files and go from there.

Related

Setting nginx and apache for whm panel

(Sorry for my english, I use translator)
I have a MyBB forum with good attendance, Server: Centos 7, Whm + cpanel, Apache
Sites open for a long time, we decided to go nginx
I installed use one button nginx in whm panel
The site works faster but guests have become like 1 user as if they were assigned 1 ip
What other settings need to do to fix it?
I was told that: nginx is configured to ask a local apache to desserve php, but it's not forwarding the user IP
I was told that when using nginx it's better to use php-fpm with sock
I used google to find articles, I can not find the right folders for php-fpm and sock, In whm panel, everything is different, maybe you know a normal article How to configure it? I will be very grateful
Hi #Alberto and welcome on SO for your first post.
By using nginx as a reverse proxy in front of apache the IP you see is currently the nginx one instead of the visitor's one
Cpanel has a tutorial to fix this https://support.cpanel.net/hc/en-us/articles/360051107513-Restoring-visitors-IP-with-mod-remoteip
I won't paste the full solution here, but if the link becomes broken in the future, basically you need to install the apache mod_remoteip.

How do I execute PHP on a cPanel server?

I have a LAMP application that works. I can deploy this in 15 minutes on a Linux server. I was handed a VPS to deploy it. All I get is WHM. I created an account and that got me a login to cPanel and to the box. cPanel ran some wizard that told me to put my "web source files" in /public_html There is an /cgi-bin inside of that. I cannot get any web assets to be visible from any of those folders. All I get is 404 not found. chmod 777. 404 not found.
My simple question is this: how could I get a simple hello world PHP script to run on a cPanel server? I've been building web pages since before we called them web pages. I do not need to know anything about PHP itself I want to know how to get the cPanel managed server to run PHP scripts. All the documentation I can find on cPanel assumes you've been using it forever. I just need some basic information. Where do I put my PHP code ?????
This is the way cPanel works. If you host your website on shared IP address (main IP address of your server), you cannot access your website using IP address directly. You will always redirect to "http://IP/cgi-sys/defaultwebpage.cgi URL.
To access your website without pointing our domain to your server, you can use temporary URL. By default, it is enabled on the cPanel server. You can access the temporary URL using the following URL:
http://IP/~cpanel_user
Please note that the temporary URL does not work under the following configuration:
If you have enabled mod_userdir tweak and didn't exclude default host
If your server is configured to use mod_ruid2
Hope this information will help you with future use.

Cannot Get Laravel Welcome Page to Show

My server is on DigitalOcean cloud. I am using Ubuntu with Apache web server. My home computer is running Windows 7. I am using putty for terminal.
Followed all of the directions on https://laracasts.com/series/laravel-5-fundamentals/episodes/1. Made it up to 8:40, where it directs you to run php -S localhost:8888 -t public. I run that, then open a web browser and tried the following:
-http://mywebsite.com:8888
-http://www.mywebsite.com:8888
-http://mywebsite.com/learning-laravel-5/public
-http://mywebsite.com/learning-laravel-5/public/index.php
None of the above work.
In Google Chrome, the first two options where I list the port number, I get a page saying This webpage is not available. ERR_CONNECTION_REFUSED. In IE, I just get a page with big font saying "This page can't be displayed."
For the last two options, I just get a completely blank page. In the console, I get this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error).
I'm trying to pick up a web app framework to broaden my php skill set. Can someone help me out? What am I doing wrong/what is the video tutorial missing that I have to do in order to get Laravel up and running?
php -S localhost:8888 -t public is meant for running a site locally, which is what the video is showing.
If you are using a Digital Ocean droplet with Ubuntu and Apache, you will need to configure Apache to use /public as the document root and have Laravel installed in the /var/www directory.
From there you can visit the droplet's IP address (http://XXX.XXX.XXX.XXX) instead of the domain name (unless you have configured the DNS for that domain name). You won't need the port in the URL either, since Apache will be serving it on the default port 80.
This probably is not the answer you want, but here's my advice based on setting up a few VPSs on Digital Ocean. Step back. Spin a new VPS. Keep your old one around, if you want, but start afresh.
Create a new droplet
Setup your SSH and PuTTY and make sure that works
Setup your FTP (if you're using it)
Setup your DNS
Setup your Apache config files. DO has a very good tutorial on this: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
Now, work on getting your "Hello world" html page to show when you access your domain www.yourdomain.com, yourdomian.com. Don't fixate on ports at this point, just get a minimal server running. This might help too: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
Make an saved "image" of this basic working setup so you can spin a new VPS if you need to.
Now that you have a server that loads your domain index page, you can start to install your Laravel.
In a nutshell, I'd advise you to establish a stable working server platform before you try to install and launch a more complex technology like Laravel, or Rails, etc.
Tutorials often make complex technologies seem easy, the 10-minute expert, but there is tremendous complexity masked under the hood of these frameworks. Start simple and build on a server one piece at a time. You have to walk before you run.
I use Laravel often, but my experience with servers is more relevant here. Everything you've said indicates an access problem, and knowing how hosting companies work, they probably have that port blocked (along with all other non-standard ports).
You can test this using PuTTY, open it up and enter the host name of your server. Change the port to 80 and change close on window exit to never, then connect. Enter:
GET / HTTP/1.1
Host: yourwebsite.com
Then press enter twice and the server will process the result. It should show you the HTML of your home page.
Now try it again with port 8888 and see if you can even connect. If you can connect then it's not a port issue, but my guess is you'll get a fatal error Network error: Connection refused, which means the port is closed or blocked via firewall.
Even though DigitalOcean give you complete control over the server, the connection probably still runs through their firewall. It's possible that you have your own firewall, but otherwise if the server runs through their firewall and the port is blocked nothing you can do on the server will open that port.
did you try chmod -R 0777 storage ?

Mediawiki + Sub-domain + SSL returns 404 error when accessing secure site

Using CPanel/Softaculous to install Mediawiki on my hosted website appears to install fine. Though not sure how much the installer checks.
I then setup a sub-domain such as wiki.mydomain.com to accept requests there.
After that, I also setup SSL cert in Cpanel. The cert is self-signed because at the moment I am just testing out the wiki and everything before I decided if I will purchase a cert.
Then, if I attempt to go to http://wiki.mydomain.com. I get the landing page of MediaWiki but if I attempt to go to https://wiki.mydomain.com I get nothing but a blank browser window.
Now, if i go to https://wiki.mydomain.com/index.php, I get a 404 error (I created a simple html page with a 404 error message then modified my .htaccess to show it on the 404).
When looking at the logs, it appears to be trying to find the index.php file under /home/mydomain/public_html/index.php instead of /home/mydomain/wiki/index.php.
Very confused on why this isn't working at all. I can post some configs and things as well but this account is a newly created CPanel account so not much as been done on it other then installing the wiki software.
(Edit) This is using SharedSSL. I couldn't get it to work without it. Some reason even after I made sure the site was the only one on the IP Address using WHM it was still showing it as a shared IP. :P
Fixed the SharedSSL by using this information: Cpanel Forums
You will have to make a new install of MediaWiki via Softaculous. Go on the install form you will get an option to "Choose Protocol" choose https:// there and in the "Choose Domain" dropdown choose your subdomain https://wiki.mydomain.com leave the "In Directory" field blank and then click on Install button.
Then you should be able to access the MediaWiki install at https://wiki.mydomain.com
I think the reason for this issue is due to how cPanel works with sub-domains and SSL. From what I gather, this appears to be a SSL cert issue since when CPanel rebuilds the httpd.conf using /scripts/rebuildhttpdconf command, it does not create a SSL virtual host for the sub-domain. Also, the parent domain works fine.
I ended up putting the wiki in /home/mydomain/public_html/wiki then setting up redirects for http://mydomain.com and https://domain.com to point to https://mydomain.com/wiki.
For now, that's all I could figure out to fix the issue was to drop the sub-domain.

How to access PHP files using HTTP over peer-to-peer network?

I connected two PCs (say PC1 and PC2) using a patch cable (Category 5E) while both of them run on Windows 7. The IP addresses for PC1 and PC2 are 192.168.1.2 and 192.168.1.3, respectively. I've successfully configured a homegroup for the two computers and there was no problem in simple file sharings.
What I should know is that, having installed WAMPServer and stored some PHP files in PC1's root directory, how could I access them from PC2? I tried typing 'http://192.168.1.2/aphpfile.php' in the PC2's browser. And, I got no expected result. The browser simply said that it could not access the page. I'm not an expert in networking. Please help me.
PS: Please, don't close this question as a duplication. I searched related questions in this site but nothing was found helpful to me.
By default, WAMP assumes you're developing locally and will not answer requests made from outside the machine. You have to click "put online" from the WAMP menu. It will configure Apache to start listening for incoming connections from outside your machine.

Categories