Welcome! Log In Create A New Profile

Advanced

Re: Serving website with Apache, with Nginx as interface?

Alex Hall
May 13, 2016 01:26PM
As a quick update, setting
proxy_set_header Host $host;
seems to have gotten the URL working, but OSTicket is still giving me the
same error I was getting when I was serving it with Nginx directly. Worse,
the Apache2 access log shows none of my recent attempts to access the site,
though it does show older ones. The Nginx access log shows all the
accesses, though. It's as though the proxy weren't working properly at all.
I have it set up in a location:

upstream apache2Redirect {
server 127.0.0.1:8080;
}

location / {
proxy_set_header Host $host;
proxy_pass http://apache2Redirect;
}

My understanding is that the / will match everything, from /index.html to
/images/small/235.jpg. Is that not the case? Do I need to do something to
my location block, by chance?

On Fri, May 13, 2016 at 1:20 AM, Yuriy Medvedev <medvedev.yp@gmail.com>
wrote:

> Sorry, backend1 its upstream in nginx configuration
> upstream backend1 {
> #ip of Apache back-end
> server 192.168.0.1:8080;
> }
>
> 2016-05-13 1:59 GMT+03:00 Alex Hall <ahall@autodist.com>:
>
>> Thanks! I followed you, until the proxy_pass. What is backend1, and where
>> is it defined? I know it's something you made up, but how does it know
>> about Apache, or Apache about it?
>>
>> On May 12, 2016, at 17:56, Yuriy Medvedev <medvedev.yp@gmail.com> wrote:
>>
>> Hi, you can use vhost in Apache and configure proxy_pass in nginx
>> configuration
>> For apache2 somthing like that
>> <VirtualHost *:8080>
>> ServerName foo.bar
>>
>> DocumentRoot /home/sites/
>> <Directory /home/sites/>
>> Order deny,allow
>> Allow from all
>> </Directory>
>>
>> ErrorLog /home/sites/logs/apache_error.log
>> CustomLog /home/sites/logs/apache_access.log combined
>>
>> etc.......
>> </VirtualHost>
>> For nginx
>> server {
>> listen 80;
>> server_name foo.bar;
>>
>> access_log /home/sites/logs/nginx_access.log;
>> error_log /home/sites/logs/nginx_error.log;
>>
>> location / {
>> proxy_pass http://backend1;
>> etc.....
>> }
>> }
>>
>> 2016-05-13 0:34 GMT+03:00 Alex Hall <ahall@autodist.com>:
>>
>>> Hello all,
>>> Here's what I'm trying to do. I have two sites, sd1.mysite.com and
>>> sd2.mysite.com. The fun part is that sd1 is a Flask app, served by
>>> Nginx. However, sd2 is OSTicket, which must be served by Apache, it seems.
>>> Of course, Apache and Nginx can't listen to port 80 at the same time, and
>>> as this is a subdomain on a local, Windows DNS, I can't make
>>> sd2.mysite.com point to myip:8080 or anything like that.
>>>
>>> Thus, my best option appears to be this: Nginx listens to all incoming
>>> traffic on 80. If the request is for anything to do with sd1, it handles it
>>> just like it does now. However, if the request is for sd2, Nginx somehow
>>> hands off the request to Apache, then returns what Apache gives it back to
>>> the user.
>>>
>>> I've heard that people use Apache and Nginx together, but I haven't
>>> found anyone who uses them to serve two subdomains, with Nginx as the
>>> "gateway" and handler of one subdomain, and Apache as the handler for the
>>> other subdomain. Is there any way to do this? Am I even making sense?
>>> Thanks for any ideas anyone has.
>>>
>>> --
>>> Alex Hall
>>> Automatic Distributors, IT department
>>> ahall@autodist.com
>>>
>>> _______________________________________________
>>> nginx mailing list
>>> nginx@nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



--
Alex Hall
Automatic Distributors, IT department
ahall@autodist.com
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Serving website with Apache, with Nginx as interface?

Alex Hall May 12, 2016 05:36PM

Re: Serving website with Apache, with Nginx as interface?

Sven Kirschbaum May 12, 2016 05:48PM

Re: Serving website with Apache, with Nginx as interface?

Yuriy Medvedev May 12, 2016 05:58PM

Re: Serving website with Apache, with Nginx as interface?

Alex Hall May 12, 2016 07:00PM

Re: Serving website with Apache, with Nginx as interface?

Yuriy Medvedev May 13, 2016 01:22AM

Re: Serving website with Apache, with Nginx as interface?

Alex Hall May 13, 2016 01:26PM

Re: Serving website with Apache, with Nginx as interface?

Francis Daly May 14, 2016 05:20AM

Re: Serving website with Apache, with Nginx as interface?

Alex Hall May 14, 2016 07:34AM

Re: Serving website with Apache, with Nginx as interface?

Alex Hall May 16, 2016 08:52AM

Re: Serving website with Apache, with Nginx as interface?

Francis Daly May 17, 2016 01:38PM

Re: Serving website with Apache, with Nginx as interface?

Alex Hall May 17, 2016 01:50PM

Re: Serving website with Apache, with Nginx as interface?

itpp2012 May 14, 2016 05:55AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready