Re: apache configuration --running two/2 test sites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allegedly, on or about 17 October 2018, bruce sent:
> Sorry to return...  I'm still really screwing up things/something
> with my test for displaying two(2) apps..

Apps?  That may have its own set of problems, as opposed to serving two
sites.

Have you tried running Apache on your own machine, to get a feel for
how it works?

> The two apps are oxwall and b2evolution. To refresh, I have a test
> digitialocean server that's at http://104.248.125.83/
> 
> I'm simply trying to access the two apps at two different urls
> 
> oxwall  http://104.248.125.83/oxwall
> b2evolution  http://104.248.125.83/foo

By default, Apache listens to all requests and serves them up from a
default web root directory.  In our (Fedora) case, /var/www/html/

You can put anything in there, and it'll be served when you browse to
it by name.

Put a *file* in there called *oxwall*, browse to the IP address of your
server with /oxwall in the requested address, as your example above,
and Apache will serve it.

e.g. Local file /var/www/html/oxwall
     Accessed as http://104.248.125.83/oxwall

Of course, that file "oxwall" has to be something that's serveable by
Apache in a recognisable way (such as it being HTML, or an executable,
and Apache being set up to handle such executables).

Alternatively, put a directory called /oxwall/ in there, and Apache
will serve the default file in that directory (usually, it looks for
index.html, but you can define your own defaults).

e.g. Local file /var/www/html/oxwall/index.html
     Accessed as http://104.248.125.83/oxwall


Where you *may* be coming unstuck is the host providing your site:  If
that IP is shared with other sites, then you are going to *need* your
own registered domain name, so that hosting service can look up your
name and relate it to the server IP.


I'll truncate your configuration comments, the presupplied comments
aren't needed, and just make a lot of reading to wade through.

> 
> I have the following /etc/httpd/httpd.conf as well:::
> 
> cat  /etc/httpd/conf/httpd.conf
> 
> ServerRoot "/etc/httpd"
> Listen 80
> Include conf.modules.d/*.conf
> User apache
> Group apache
> 
> ServerAdmin root@localhost

You ought to, eventually, get around to changing that to a real
webmaster address.


> #ServerName www.example.com:80
> #ServerName 104.248.125.83:80

At the moment, since no servername is set, Apache will figure out the
hostname for itself.  On a server farm, that could be something quite
gibberish, and will be unrelated to what you think your site address
ought to be.

> <Directory />
>     AllowOverride none
>     Require all denied
> </Directory>
> 
> DocumentRoot "/var/www/html"
> 
> <Directory "/var/www">
>     AllowOverride None
>     # Allow open access:
>     Require all granted
> </Directory>
> 
> <Directory "/var/www/html">
>     Options Indexes FollowSymLinks
>     AllowOverride None
>     Require all granted
> </Directory>
> 
> <IfModule dir_module>
>     DirectoryIndex index.html
> </IfModule>
> 
> <Files ".ht*">
>     Require all denied
> </Files>
> 
> ErrorLog "logs/error_log"
> 
> LogLevel warn
> 
> <IfModule log_config_module>
> 
>     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\"" combined
>     LogFormat "%h %l %u %t \"%r\" %>s %b" common
> 
>     <IfModule logio_module>
>       # You need to enable mod_logio.c to use %I and %O
>       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\" %I %O" combinedio
>     </IfModule>
> 
>     CustomLog "logs/access_log" combined
> </IfModule>
> 
> <IfModule alias_module>
>     
>     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
> 
> </IfModule>
> 
> <Directory "/var/www/cgi-bin">
>     AllowOverride None
>     Options None
>     Require all granted
> </Directory>
> 
> <IfModule mime_module>
> 
>     TypesConfig /etc/mime.types
> 
>     AddType application/x-compress .Z
>     AddType application/x-gzip .gz .tgz
> 
>     #AddHandler cgi-script .cgi
> 
>     AddType text/html .shtml
>     AddOutputFilter INCLUDES .shtml
> </IfModule>
> 
> 
> AddDefaultCharset UTF-8
> 
> <IfModule mime_magic_module>
>     MIMEMagicFile conf/magic
> </IfModule>
> 
> #ErrorDocument 500 "The server made a boo boo."
> #ErrorDocument 404 /missing.html
> #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
> #ErrorDocument 402 http://www.example.com/subscription_info.html
> #
> 
> #EnableMMAP off
> EnableSendfile on
> 
> IncludeOptional conf.d/*.conf
> IncludeOptional sites-enabled/*.conf

Those all look normal to me.

> ===========================================================================
> 
> [root1@centos7-drupal-client-crawl-5d-jul13-18-1gb html]$ sudo cat /var/log/httpd/access_log
> 
> 
> 74.178.140.153 - - [17/Oct/2018:06:31:49 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 340
> 74.178.140.153 - - [17/Oct/2018:06:31:55 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 83
> 74.178.140.153 - - [17/Oct/2018:06:32:00 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 83
> 74.178.140.153 - - [17/Oct/2018:06:32:03 -0400] "GET /foo/index.php HTTP/1.1" 200 42999
> 74.178.140.153 - - [17/Oct/2018:06:32:12 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 83
> 74.178.140.153 - - [17/Oct/2018:06:32:18 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 83
> 74.178.140.153 - - [17/Oct/2018:06:32:24 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 340
> 74.178.140.153 - - [17/Oct/2018:06:32:29 -0400] "POST /oxwall/base/ping/index/ HTTP/1.1" 200 83

The "200" response codes (at the end of each line, are "OK" responses. 
The number afterwards may be the number of bytes served (it depends on
the software responding).

> 
> ==============================
> using the "base" /etc/httpd/conf/httpd.conf file
> -change:
> 
> ServerName 104.248.125.83:80
> DocumentRoot "/var/www/html"

That document root directive has to match what you actually use (are
your files in there?).

> 
> # Load config files in the "/etc/httpd/conf.d" directory, if any.
> IncludeOptional conf.d/*.conf
> IncludeOptional sites-enabled/*.conf
> ==============================
> 
> 
> include a conf file in the /etc/httpd/sites-available/
> ::/etc/httpd/sites-enabled/b2evolution.conf::
> 
> sudo cat /etc/httpd/sites-available/b2evolution.conf
> 
> <VirtualHost 104.248.125.83:80>
>    ServerAdmin admin@xxxxxxxxxxxxxxx
>    DocumentRoot /var/www/html/

Again, that document root directive has to match what you actually use
(are your files in there?).  Or should that be: /var/www/html/oxwall

Sometimes the trailing slash you've used (in the document root
directive) causes problems.  The recommendation was, generally
speaking, not to do so.

>    ServerName 104.248.125.83
>    #ServerAlias 104.248.125.83
> 
>       <Directory /var/www/html/oxwall/>

Likewise with the trailing slash, here, too.

>          Options Indexes FollowSymLinks MultiViews
>          AllowOverride All
>          Order allow,deny
>          allow from all
>       </Directory>
> 
>    ErrorLog /var/log/httpd/error_log
>    CustomLog /var/log/httpd/access_log common
> </VirtualHost>
> 
> 
> running with ::
>  sudo service httpd restart
> 
> using //http://104.248.125.83/
> --this gets the basic/default apache page
> 
> running //http://104.248.125.83/oxwall
>     --redirects (??) http://104.248.125.83/foo/index.php
> Not Found
> 
> The requested URL /foo/index.php was not found on this server.
> 
> 
> running //http://104.248.125.83/foo
>     --redirects (??) http://104.248.125.83/foo/index.php
> Not Found
> 
> The requested URL /foo/index.php was not found on this server.

I saw no redirects in your samples above, some info from you is
missing.  Perhaps the server has some preconfigure 404 error notices? 
Or it's some PHP configurations?

> sudo httpd -S
> VirtualHost configuration:
> 104.248.125.83:80      104.248.125.83
> (/etc/httpd/sites-enabled/b2evolution.conf:4)
> ServerRoot: "/etc/httpd"
> Main DocumentRoot: "/etc/httpd/htdocs"
> Main ErrorLog: "/etc/httpd/logs/error_log"
> Mutex authdigest-opaque: using_defaults
> Mutex proxy-balancer-shm: using_defaults
> Mutex rewrite-map: using_defaults
> Mutex authdigest-client: using_defaults
> Mutex proxy: using_defaults
> Mutex authn-socache: using_defaults
> Mutex default: dir="/run/httpd/" mechanism=default
> Mutex mpm-accept: using_defaults
> PidFile: "/run/httpd/httpd.pid"
> Define: _RH_HAS_HTTPPROTOCOLOPTIONS
> Define: DUMP_VHOSTS
> Define: DUMP_RUN_CFG
> User: name="apache" id=48
> Group: name="apache" id=48
> 
> 
> 
> ---------------------------------------------------------------------------
> 
> using the following modified conf
> 
> ::/etc/httpd/sites-enabled/b2evolution.conf::
> sudo cat /etc/httpd/sites-available/b2evolution.conf
> 
> <VirtualHost 104.248.125.83:80>
>    ServerAdmin admin@xxxxxxxxxxxxxxx
>    DocumentRoot /var/www/html/oxwall
>    ServerName 104.248.125.83
>    #ServerAlias 104.248.125.83
> 
>       <Directory /var/www/html/oxwall/>
>          Options Indexes FollowSymLinks MultiViews
>          AllowOverride All
>          Order allow,deny
>          allow from all
>       </Directory>
> 
>    ErrorLog /var/log/httpd/error_log
>    CustomLog /var/log/httpd/access_log common
> </VirtualHost>
> 
> 
> 
> running with ::
>  sudo service httpd restart
> 
> using //http://104.248.125.83/
> --this generates the "correct" oxwall home page...
> 
> running //http://104.248.125.83/oxwall
>     --redirects (??) http://104.248.125.83/foo/index.php
> 
>     --but also displays the oxwall home page???  why????
> 
> 
> running //http://104.248.125.83/foo
>     --redirects (??) http://104.248.125.83/foo/index.php
> 
>     --but also displays the oxwall home page???  why????
>     --this isn't the "foo" (b2evolution) page...

I don't know where the redirections are coming from, you haven't shown
anything that has *that* configured.

If you do want two sites, then the virtual hosts configurations should
specify both sites *uniquely*.

<VirtualHost 104.248.125.83:80>    (if that IP might change,then use:  _default_:80)
    ServerAdmin     (should have your webmaster address)
    DocumentRoot    (unique path to this site's document root)
    ServerName      (fully-qualified domain name)
    #ServerAlias    (optional extra domain names for same site)
 
       <Directory   path to this site's document root>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Order allow,deny
          allow from all
       </Directory>
 
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access_log common
 </VirtualHost>


<VirtualHost 104.248.125.83:80>
    ServerAdmin     (should have your webmaster address)
    DocumentRoot    (unique path to this other site's document root)
    ServerName      (fully-qualified other site's domain name)
    #ServerAlias    (optional extra domain names for this site)
 
       <Directory   path to this site's document root>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Order allow,deny
          allow from all
       </Directory>
 
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access_log common
 </VirtualHost>

The "DocumentRoot" directive sets where the site serves files from. 
The "Directory" options set file access permissions.

> sudo httpd -S
> VirtualHost configuration:
> 104.248.125.83:80      104.248.125.83
> (/etc/httpd/sites-enabled/b2evolution.conf:4)
> ServerRoot: "/etc/httpd"
> Main DocumentRoot: "/etc/httpd/htdocs"
> Main ErrorLog: "/etc/httpd/logs/error_log"
> Mutex authdigest-client: using_defaults
> Mutex proxy: using_defaults
> Mutex authn-socache: using_defaults
> Mutex default: dir="/run/httpd/" mechanism=default
> Mutex mpm-accept: using_defaults
> Mutex authdigest-opaque: using_defaults
> Mutex proxy-balancer-shm: using_defaults
> Mutex rewrite-map: using_defaults
> PidFile: "/run/httpd/httpd.pid"
> Define: _RH_HAS_HTTPPROTOCOLOPTIONS
> Define: DUMP_VHOSTS
> Define: DUMP_RUN_CFG
> User: name="apache" id=48
> Group: name="apache" id=48
> 
> 
> ------------------------------------------------------------------------------
> using the following modified conf
> 
> ::/etc/httpd/sites-enabled/b2evolution.conf::
> sudo cat /etc/httpd/sites-available/b2evolution.conf
> 
> <VirtualHost 104.248.125.83:80>
>    ServerAdmin admin@xxxxxxxxxxxxxxx
>    DocumentRoot /var/www/html/b2evolution
>    ServerName 104.248.125.83
>    #ServerAlias 104.248.125.83
> 
>       <Directory /var/www/html/b2evolution/>
>          Options Indexes FollowSymLinks MultiViews
>          AllowOverride All
>          Order allow,deny
>          allow from all
>       </Directory>
> 
>    ErrorLog /var/log/httpd/error_log
>    CustomLog /var/log/httpd/access_log common
> </VirtualHost>
> 
> 
> 
> running with ::
>  sudo service httpd restart
> 
> using //http://104.248.125.83/
>     --redirects (??) http://104.248.125.83/foo/index.php
> Not Found
> 
> The requested URL /foo/index.php was not found on this server.
> --why ??????????

Is there a "foo/index.php" inside of "/var/www/html"?

> 
> 
> running //http://104.248.125.83/oxwall
>     --redirects (??) http://104.248.125.83/foo/index.php
> Not Found
> 
> The requested URL /foo/index.php was not found on this server.
> --why ??????????
> 
> 
> running //http://104.248.125.83/foo
>     --redirects (??) http://104.248.125.83/foo/index.php
> Not Found
> 
> The requested URL /foo/index.php was not found on this server.
> --why ??????????
> 
> 
> 
> sudo httpd -S
> VirtualHost configuration:
> 104.248.125.83:80      104.248.125.83
> (/etc/httpd/sites-enabled/b2evolution.conf:4)
> ServerRoot: "/etc/httpd"
> Main DocumentRoot: "/etc/httpd/htdocs"
> Main ErrorLog: "/etc/httpd/logs/error_log"
> Mutex authdigest-opaque: using_defaults
> Mutex proxy-balancer-shm: using_defaults
> Mutex rewrite-map: using_defaults
> Mutex authdigest-client: using_defaults
> Mutex proxy: using_defaults
> Mutex authn-socache: using_defaults
> Mutex default: dir="/run/httpd/" mechanism=default
> Mutex mpm-accept: using_defaults
> PidFile: "/run/httpd/httpd.pid"
> Define: _RH_HAS_HTTPPROTOCOLOPTIONS
> Define: DUMP_VHOSTS
> Define: DUMP_RUN_CFG
> User: name="apache" id=48
> Group: name="apache" id=48
> 
> 
> ---------------------------------------------------------------------
> 
> I've also tried different variations of the following, where I have
>  two directory blocks...
>  -I can't seem to dynamically "point/redirect" to the different
>   dirs to get the different apps to work...
> 
> I know there's something simple/subtle that eludes me..
> 
> I'm more than willing to provide the user/passwd to the test server.
> The test server is a simple throwaway digitalocean cheap instance so
> I can kill it/redo with no issue..

Are your examples above actual examples?  Or have you bowlderised them?

As a simplification to your tests, put a plain HTML landing page into
each site.  You can test Apache in a simplified manner, that way.

e.g. write a basic index.html page into each site's directory
(presuming index.html is that Apache's default file to look for), like
this:

    <title>oxwall test page</title>
    <p>oxwall test page</p>

It can be hard to debug software setups with webhosts, as they don't
have the same version of Apache (nor same configuration) as we use. 
Before running live sites on the web, I ran Apache on my own systems
and configured it there.  You don't have to contend with triggering off
firewall alerts and locking yourself out, etc., as you stuff up.

You may be overcomplicating things, though.  If you have a unique IP
(i.e. you don't share it with other people), you don't need to set up
virtual hosts.  Just use the main Apache configuration.

-- 
[tim@localhost ~]$ uname -rsvp
Linux 4.16.11-100.fc26.x86_64 #1 SMP Tue May 22 20:02:12 UTC 2018 x86_64

Boilerplate:  All mail to my mailbox is automatically deleted.
There is no point trying to privately email me, I only get to see
the messages posted to the mailing list.

Using Windows software is like coating all your handtools with sewage.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux