Ubuntu with Nginx and Apache - Issues with Reaching Nginx Landing Page - apache

I have an Ubuntu Server with both apache2 and nginx installed (Apache2 was installed by the system admin, and I installed nginx).
I cannot reach the default port that nginx is set to, it redirects me to apache's default page. I've tried changing the /etc/nginx/sites-enabled/default file to:
server {
listen 81 default_server;
listen [::]:81 default_server;
}
I restarted/reloaded the nginx service after making the changes but still land on the apache2 page. Is there something else that I need to edit in order to be able to access nginx? Thank you.

Related

Can EasyPHP Devserver Appache Listen to Multiple Ports?

Installed EasyPHP Devserver on Windows 7.
EasyPHP Devserver Version 17.0 (pretty the latest)
EasyPHP Devserver Apache Version 2.4.25
You may skip direct to my conclusion below.
Here is my process of trials.
In the httpd.conf file, I added the second Listen port
Listen 127.0.0.1:80
Listen 127.0.0.1:8080
Then at the EasyPHP Devserver website console (http://127.0.0.1:1111) I restart the Apache. the httpd.conf file will be rewritten to the following, and Apache cannot start. (Where can I see the error log? Nothing written into EasyPHP Devserver\eds-binaries\httpserver\apache...\logs)
Listen 127.0.0.1:80
Listen 127.0.0.1:80
If I leave the httpd.conf file with only one Listen port
Listen 127.0.0.1:8080
Apache starts successful, but httpd.conf is also rewritten back to
Listen 127.0.0.1:80
And in the EasyPHP Devserver website console (http://127.0.0.1:1111) > Http Server Settings (the gear icon) > there is a drop down menu for us to select the Port: 80.
There are a few options, 80 8080, 8000, 8888, 8008. If I change here, and restart the Apache. the httpd.conf is updated according to this setting.
Conclusion
My conclusion is, no matter what I set in the httpd.conf file, the Listen 127.0.0.1:80 will be rewritten by the setting in the EasyPHP Devserver website console > Http Server Settings > Port. The real setting is controlled by the EasyPHP Devserver website console. The httpd.conf file Listen directive is not functionable.
Question
Here comes the question. In fact I only wish to configure Apache Listens to multiple port, 80 for production and 8080 for development. How can I do it?
Nice. I find out a Brute-Force solution.
In EasyPHP-Devserver-17\eds-binaries\httpserver\apache...\eds-app-actions.php line 97, it is replacing the website console settings to the Apache httpd.conf. I just commented // file_put_contents (__DIR__ . '\conf\httpd.conf', $serverconffile); and Apache httpd.conf will not be overwritten anymore. Nice.
See? The is one of the best parts of open-source. We can always Brute-Force it.
you have to comment line 66,67:
//$replacement = '${1}' . $server_port;
//$serverconffile = preg_replace('/^([\s|\t]*Listen.*\:[\s|\t]*)(.*)$/m', $replacement, $serverconffile);
the line update port number

Tomcat 7 behind NGINX forwarding ssl

I have currently setup Apache Tomcat 7 in port 8080 and I am using NGINX with a Let's Encrypt SSL in front of it as a reverse proxy. The current configuration is working like a charm, but I need one be able to pass to Tomcat when the page been view is using SSL or not.
I found on the documentation the use of SSLValve in the server.xml file should do the trick, but the examples I have found are for apache as the reverse proxy and not for NGINX.
Has anyone done this setup?
Assuming you're using :8080 as the backend for both http and https:
server {
listen :80;
listen :443 defaultserver ssl;
...ssl directives....
location ~ / {
proxy_pass http://apache:8080;
}
NGINX configuration can fill in the ssl directive parts for your particular case
http://nginx.org/en/docs/http/configuring_https_servers.html

When enable SSL on Nginx page redirects to default page

I have a nginx server which is running multiple vhost, I have configured one more vhost and tried to make it https, but when I tried to access it redirects to default page. I have configured SSL certs with letsencrypt.
my config file is
server {
listen 443 ssl;
root /var/www/html;
server_name abc.xyz.com;
include includes/letsencrypt;
location / {
proxy_pass http://abc;
include includes/proxy-config;
}
}
I have also tried with below config
server {
listen 80;
server_name abc.xyz.com;
return 301 https://abc.xyz.com$request_uri;
}
server {
listen 443 ssl;
server_name abc.xyz.com;
ssl on;
include includes/letsencrypt;
access_log /var/log/nginx/log/abc.access.log;
error_log /var/log/nginx/log/abc.error.log;
location /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
location / {
proxy_pass http://abc;
}
}
After this page is redirecting to my firewall.
Port 443 is also opened up.
Any Ideas what is wrong here?
I have nail down this by adding NAT rule in firewall.
Basically nothing wrong in above configuration.
I had only opened port on firewall.
As opening port is just between Internet and firewall
NAT redirects traffic from public-ip:443 -> local-ip:443
I too had this problem, but for me the solution was eventually found in a problem with the configuration file for php-fpm. There was a problem creating/accessing the error log for php-fpm, which I had turned on myself in the config file for php-fpm earlier thinking it was a good thing to do. Turning it back off again, restarting php-fpm and nginx got everything working as expected.
Just in case you're googling around like I was and kept finding this question at the top ;-)

GitLab: How to use ONLY Apache2 and skip nginx?

I am running GitLab on Port 81 today and I need it to run on Port 80 or 443 so that I can access it from office. Problem is that I already host other services using Apache2 on both those ports.
I have tried for hours and hours to do a proxy forward of GitLab from Apache2 host:80/gitlab to host:81 (where nginx is hosting gitlab) without success. I just keep getting problems thanks to the added folder /gitlab in the URL.
So I am in the idea of selfhosting gitlab under my Apache2 server instead. I am thinking of this approach:
Create symlink to webroot of gitlab from /home/www/sites/gitlab
Set up a vhost in Apache on port 81 to point to above symlink.
Enable Apache2 to listen on port 81.
Verify that GitLab functions properly on port 81 using Apache2.
Once confirmed, set up a proxy forward from my Apache2 Port 80 under subdir /gitlab to forward to the new Apache2 Port 81 now hosting GitLab.
What I need to know now is:
Is it possible to completely host gitlab on your own Apache2?
What is necessary to enable in Apache2 virtual host dir? Or other configs? Ruby etc?
Where is the webroot of github index documents etc?
What do you think of permission issues? Will I see any problems?
Thank you all in advance!

Problems with Apache Tomcat and Wamp

this is probably a noob problem but I can't get this to work. The Apache on wamp is currently on Listen 8080 because the regular localhost wouldn't work. However when I turn on Tomcat it is also on 8080 which is conflicting with wamp. I am connecting to Tomcat via Eclipse plugin. With Tomcat on I can't get into phpmyadmin on wamp.
Apache's httpd.conf in wamp is set to:
Listen 8080
ServerName localhost:80
Only with this setting I can get wamp to work.
localhost:8080 will work and 127.0.0.1:8080 works as well. Turning on Tomcat will automatically override wamp's settings. How can I get wamp to just be a regular localhost address and not have it take an 8080 port where Tomcat is sitting on?
try to change the port tomcat is using.
Go to conf folder in tomcat installation directory
e.g. C:\Tomcat 6.0\conf\
Edit following tag in server.xml file
Change the port=8080 value to port=80
Save file.
or another solution is , you can change your wamp port from 8080 to any other one...