Setting nginx and apache for whm panel - php

(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.

Related

Deploy SSL-enabled website to WHM-managed VPS

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.

Want To Turn Off Drupal App So I can Run Meteor App In server

I am not familiar with drupal or php. I had some developers do my website and they installed it on my digital ocean server.
However I learned how to code and redid the site to my liking, using meteor instead.
I am using 'mup' to deploy the app, and I already did this in a test domain, so it works fine. The problem is that in my real domain, I have the drupal app running, and I don't know how to turn it off.
If it was meteor I could do something like 'mup stop' and it would terminate the process on port 80. But I have been looking how to do this with drupal and the LAMP stack but I don't know how to do it.
IMPORTANT: I have an existing database that I will need in the future from the drupal app, so reseting the server is not really an option. I just want to stop it from running.
This worked! Killed the process running on port 80 and my site was working!
sudo kill `sudo lsof -t -i:80`
Drupal is not an app it's a website. If you want to stop the drupal website then stop apache server with command "service apache2 stop" or any equivalent command which stops your web server only.
Or else you can remove pointing your domain to the particular ip address where drupal website is hosted so that your website will not open in that domain.
Thanks

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 ?

localhost doesn't work

I'm trying to solve out my problem since more than a week, but with no results until now.
When I try to open localhost/phpmyadmin, or any php file, I get on this message:
Internet Explorer cannot display the webpage ".
The same happens with Mozilla; no errors, but the page keeps loading without answer.
My configuration
Windows 7 32bit
Wampserver 2.2D ( all services are running ) green status, server online
My hosts file
127.0.0.1 localhost
::1 localhost
IIS is stopped, but I don't think it's a problem with port 80.
I tried going directly to 127.0.0.1, it didn't work.
I will appreciate any advice.
Thanks
You may want to check your firewall authorizations...
I had same problem; I have since added wampserver as authorized program to my firewall and, as above, stopped IIS services in control panel/admistrative tools.
I had similar problem, a lot of research and analysis but nothing helped. Finally I came across UwAmp which works like a charm for me ever since then. Try it out:
http://www.uwamp.com/
It also supports multiple versions of PHP which you can switch by single click anytime you want.
Ok so if you have IIS on, stop it.
Go to cpanel and search administrative tools, component services, services (local), and scroll to the w's to find and stop:
World wide web publishing service
and
Web deployment agent service (something like that)
Good luck.

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