Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › APACHE2 Issue with multiple nics
New Posts  All Forums:Forum Nav:

APACHE2 Issue with multiple nics

post #1 of 5
Thread Starter 
I'm trying to get my webserver to listen on 2 virtual nics. 1 is outside and one is internal, with 2 separate IP's. I have tested both individually to verify the networking is right. It is. My problem is when I have both nic's live apache only seems to listen to the internal nic. I have moved the configurations on both nics. I have swapped settings on eth0 and eth1 and it still only servers to the internal network. I'm assuming because that is the closer network ? Any thoughts, thanks!
     
CPUMotherboardGraphicsGraphics
3570K Gigabyte Z77X-UD4H EVGA FTW 660ti 2GB ASUS 660ti 2GB 
RAMHard DriveCoolingOS
Geil  SanDisk Extream Intel BXTS13X  Windows 10 64bit 
MonitorMonitorMonitorKeyboard
Acer H6 H276HLbmid Black 27"  eMachines E233Hbd Black 23" eMachines E233Hbd Black 23" Razor Black Widow Mech 
PowerCaseMouseMouse Pad
Rosewill Capstone 650w CM Storm Enfocer  Zowie ZA11 Corsair Gaming Pad 12x12" 
  hide details  
Reply
     
CPUMotherboardGraphicsGraphics
3570K Gigabyte Z77X-UD4H EVGA FTW 660ti 2GB ASUS 660ti 2GB 
RAMHard DriveCoolingOS
Geil  SanDisk Extream Intel BXTS13X  Windows 10 64bit 
MonitorMonitorMonitorKeyboard
Acer H6 H276HLbmid Black 27"  eMachines E233Hbd Black 23" eMachines E233Hbd Black 23" Razor Black Widow Mech 
PowerCaseMouseMouse Pad
Rosewill Capstone 650w CM Storm Enfocer  Zowie ZA11 Corsair Gaming Pad 12x12" 
  hide details  
Reply
post #2 of 5
How have you set up apache? Might be good to post your config tongue.gif
post #3 of 5
Thread Starter 
CONFIG:

Listen 80


ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined





ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
     
CPUMotherboardGraphicsGraphics
3570K Gigabyte Z77X-UD4H EVGA FTW 660ti 2GB ASUS 660ti 2GB 
RAMHard DriveCoolingOS
Geil  SanDisk Extream Intel BXTS13X  Windows 10 64bit 
MonitorMonitorMonitorKeyboard
Acer H6 H276HLbmid Black 27"  eMachines E233Hbd Black 23" eMachines E233Hbd Black 23" Razor Black Widow Mech 
PowerCaseMouseMouse Pad
Rosewill Capstone 650w CM Storm Enfocer  Zowie ZA11 Corsair Gaming Pad 12x12" 
  hide details  
Reply
     
CPUMotherboardGraphicsGraphics
3570K Gigabyte Z77X-UD4H EVGA FTW 660ti 2GB ASUS 660ti 2GB 
RAMHard DriveCoolingOS
Geil  SanDisk Extream Intel BXTS13X  Windows 10 64bit 
MonitorMonitorMonitorKeyboard
Acer H6 H276HLbmid Black 27"  eMachines E233Hbd Black 23" eMachines E233Hbd Black 23" Razor Black Widow Mech 
PowerCaseMouseMouse Pad
Rosewill Capstone 650w CM Storm Enfocer  Zowie ZA11 Corsair Gaming Pad 12x12" 
  hide details  
Reply
post #4 of 5
There's two ways to do this depending on what you're trying to do. If you want a different site on each IP then you need to set up virtual hosts (vhosts)
Code:
<VirtualHost $IP:80>
    ServerName $SITE_NAME
    DocumentRoot "$PATH_TO_DOCS"

    ErrorLog ${APACHE_LOG_DIR}/$SITE_NAME_error_log 
    CustomLog ${APACHE_LOG_DIR}/$SITE_NAME_access_log combined

    <Location "/">
        #Options +FollowSymLinks
        # ^ performance tweak. can be enabled if required
        AllowOverride all 
        Order allow,deny
        Allow from all 
    </Location>
</VirtualHost>
Something like that should work - just remember to change the $VAR with applicable. eg
Code:
<VirtualHost 127.0.0.1:80>
    ServerName localhost
    DocumentRoot "/srv/http/"
[...]

However you can keep ${APACHE_LOG_DIR} specifically as is because Apache should convert that variable for you.




If you want the same site served across all IPs then you need to change your listener:
Code:
Listen 80
You'll already have a line that reads "Listen xyz" - but it will probably have something like "Listen 192.168.0.1:80" if it's only working against 1 specific IP. If the line already reads as "Listen 80" (just like the code snippet above) then apache is already set to listen across every IP, so the problem you're having is elsewhere. In which case you need to check the following:
  • Software firewall (eg iptables if running on Linux).
  • Any kernel / application security modules (eg SELinux).
  • Port forwarding and/or NATing on your router / hardware firewall.
  • That you're not trying to use SSL (HTTPS) as there's some additional steps required to set that up (if you do want SSL then I can help there as well).
  • and, depending on the complexity of your LAN, the routing table

You've been quite brief so it's not clear what the problem is you're having nor what error you're receiving.
Edited by Plan9 - 10/4/13 at 5:11am
post #5 of 5
What does:
Code:
netstat -ln | grep -E ":80|:443"

return?

If you get something with 0.0.0.0 in it, or :::80 (or :::443 for HTTPS), then it's listening on both NICs already and the issue is not with your Apache config.
#well
(19 items)
 
Lenovo L530
(8 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7 4770k Gigabyte Z87X-UD4H XFX Radeon HD 6950 Corsair CMX8GX3M2A2000C9 
Hard DriveHard DriveOptical DriveCooling
Samsung EVO 840 Hitachi HDS722020ALA330 Generic DVD±RW Burner Noctua NH-D14 
OSMonitorMonitorKeyboard
Windows 8.1 Dell U2711 LG W2453 Ducky DK9008 Overclock.net Edition, Cherry MX B... 
PowerCaseMouseMouse Pad
Corsair TX850 Antec Three Hundred Corsair Raptor M40 QPAD HeatoN M 
AudioAudioAudio
E-MU Tracker|pre Beyerdynamic DT-770 250 Ohm AntLion ModMIc 
CPUGraphicsRAMRAM
Intel Ivy Bridge 3210M Intel HD 4000 Graphics Soldered Corsair Vengeance  
Hard DriveOptical DriveOSMonitor
500GB DVD-+RW Windows 7 Professional 1600x900 
  hide details  
Reply
#well
(19 items)
 
Lenovo L530
(8 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7 4770k Gigabyte Z87X-UD4H XFX Radeon HD 6950 Corsair CMX8GX3M2A2000C9 
Hard DriveHard DriveOptical DriveCooling
Samsung EVO 840 Hitachi HDS722020ALA330 Generic DVD±RW Burner Noctua NH-D14 
OSMonitorMonitorKeyboard
Windows 8.1 Dell U2711 LG W2453 Ducky DK9008 Overclock.net Edition, Cherry MX B... 
PowerCaseMouseMouse Pad
Corsair TX850 Antec Three Hundred Corsair Raptor M40 QPAD HeatoN M 
AudioAudioAudio
E-MU Tracker|pre Beyerdynamic DT-770 250 Ohm AntLion ModMIc 
CPUGraphicsRAMRAM
Intel Ivy Bridge 3210M Intel HD 4000 Graphics Soldered Corsair Vengeance  
Hard DriveOptical DriveOSMonitor
500GB DVD-+RW Windows 7 Professional 1600x900 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › APACHE2 Issue with multiple nics