1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux Webserver Woes...

Discussion in 'Tech Support' started by Faulk_Wulf, 18 Feb 2010.

  1. koola

    koola Minimodder

    Joined:
    11 Jul 2004
    Posts:
    2,462
    Likes Received:
    10
    Yes, FTP needs an ALG. If the router in question doesn't support this, then it's not worth having tbh.

    Depending if the server is to be running 24/7, an alternative is to run ESXi and monowall as the firewall. Would give greater control and configuration ability then simply use the belkin as a WAP.
     
  2. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Wouldn't that be overcomplicating everything?

    When I was a student, we had a Crapkin router at our students house. It did not do port remapping at all, despite being able to set it up in the web interface...

    If everything works locally, then your router is at fault. What you can do is make apache2 listen on port XXXX and just forward that on your router (no remap, just plain forward). You can set this in the httpd.conf file.
     
  3. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    So do i still need the entry on "Virtual Servers" on my Belkin:

    Code:
    Enable  	Description 	Inbound port 	Type  	Private IP address  	Private port
    X              Webserver       80                    TCP          192.168.2.3             80
    
    And then through SSH go:

    Code:
    sudo nano /path-to-the-file/httpd.conf
    
    And add "Port 1234" like in your SSH tutorial?

    Also, since wireless routers are like $20 anymore... what would you suggest to replace said Crapkin?

    Would it just be better for me to buy a new router then jump through all these hoops?
     
  4. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Let me rephrase (wrong file on my part):
    Code:
    Enable  	Description 	Inbound port 	Type  	Private IP address  	Private port
    X              Webserver       2280                    TCP          192.168.2.3             2280
    
    sudo vi /etc/apache2/ports.conf (link)
    Code:
    Listen 80
    Listen 2280
    
    And then to access it from the outside http://<domain>:2280. On the inside http://<IP> will still work (Apache2 will listen on both port 80 (default) and 2280)
     
  5. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    Set router as indicated.

    But the binding didn't take.

    netstat -tulpn | grep :2280 returns nothing.

    netstat -tulpn returns:

    Code:
    tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      -   
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -   
    tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      -   
    tcp        0      0 127.0.1.1:21            0.0.0.0:*               LISTEN      -   
    tcp        0      0 192.168.2.3:53          0.0.0.0:*               LISTEN      -   
    tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -   
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -   
    tcp6       0      0 ::1:953                 :::*                    LISTEN      -   
    tcp6       0      0 :::53                   :::*                    LISTEN      -   
    tcp6       0      0 :::22                   :::*                    LISTEN      -   
    udp        0      0 0.0.0.0:10000           0.0.0.0:*                           -   
    udp        0      0 192.168.2.3:53          0.0.0.0:*                           -   
    udp        0      0 127.0.0.1:53            0.0.0.0:*                           -   
    udp        0      0 0.0.0.0:68              0.0.0.0:*                           -   
    udp6       0      0 :::53                   :::*                                -   
    
    My ports.conf looks like:

    Code:
    # If you just change the port or add more ports here, you will likely also
    # have to change the VirtualHost statement in
    # /etc/apache2/sites-enabled/000-default
    # This is also true if you have upgraded from before 2.2.9-3 (i.e. from
    # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
    # README.Debian.gz
    
    Listen 80
    Listen 2080
    
    <IfModule mod_ssl.c>
        # SSL name based virtual hosts are not yet supported, therefore no
        # NameVirtualHost statement here
        Listen 443
    </IfModule>
    
    Do I need NameVirutalHost * above Listen 80?

    EDIT: I no longer get the "It works!" even locally.
     
  6. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    You did (re)start apache2, right? ;)
     
  7. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    It is. And I can access Webmin. Maybe I'll just format, buy a new router and start over.
     
  8. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Well, webmin doesn't use Apache IIRC, so that is no indication.

    If you start Apache, do you get an error? Because it really is weird. You should get an error if you have a fault in your config. Don't reformat, this isn't Windows ;)
     
  9. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    apache2 -k start

    Code:
    apache2: Syntax error on line 235 of /etc/apache2/apache2.conf: 
    Could not open configuration file /etc/apache2/sites-enabled/000-default: 
    No such file or directory
    
    sudo nano /etc/apache2/apache2.conf

    Code:
    #
    # Based upon the NCSA server configuration files originally by Rob McCool.
    #
    # This is the main Apache server configuration file.  It contains the
    # configuration directives that give the server its instructions.
    # See http://httpd.apache.org/docs/2.2/ for detailed information about
    # the directives.
    #
    # Do NOT simply read the instructions in here without understanding
    # what they do.  They're here only as hints or reminders.  If you are unsure
    # consult the online docs. You have been warned.
    #
    # The configuration directives are grouped into three basic sections:
    #  1. Directives that control the operation of the Apache server process as a
    #     whole (the 'global environment').
    #  2. Directives that define the parameters of the 'main' or 'default' server,
    #     which responds to requests that aren't handled by a virtual host.
    #     These directives also provide default values for the settings
    #     of all virtual hosts.
    #  3. Settings for virtual hosts, which allow Web requests to be sent to
    #     different IP addresses or hostnames and have them handled by the
    #     same Apache server process.
    #
    # Configuration and logfile names: If the filenames you specify for many
    # of the server's control files begin with "/" (or "drive:/" for Win32), the
    # server will use that explicit path.  If the filenames do *not* begin
    # with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.lo$
    # with ServerRoot set to "" will be interpreted by the
    # server as "//var/log/apache2/foo.log".
    #
    
    ### Section 1: Global Environment
    #
    # The directives in this section affect the overall operation of Apache,
    # such as the number of concurrent requests it can handle or where it
    # can find its configuration files.
    #
    
    #
    # ServerRoot: The top of the directory tree under which the server's
    # configuration, error, and log files are kept.
    #
    # NOTE!  If you intend to place this on an NFS (or otherwise network)
    # mounted filesystem then please read the LockFile documentation (available
    # at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
    # you will save yourself a lot of trouble.
    #
    # Do NOT add a slash at the end of the directory path.
    #
    ServerRoot "/etc/apache2"
    
    #
    # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
    #
    #<IfModule !mpm_winnt.c>
    #<IfModule !mpm_netware.c>
    LockFile /var/lock/apache2/accept.lock
    #</IfModule>
    #</IfModule>
    
    #
    # PidFile: The file in which the server should record its process
    # identification number when it starts.
    # This needs to be set in /etc/apache2/envvars
    #
    PidFile ${APACHE_PID_FILE}
    
    #
    # Timeout: The number of seconds before receives and sends time out.
    #
    TimeOut 300
    
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive on
    
    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 100
    
    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 15
    
    ##
    ## Server-Pool Size Regulation (MPM specific)
    ##
    
    # prefork MPM
    # StartServers: number of server processes to start
    # MinSpareServers: minimum number of server processes which are kept spare
    # MaxSpareServers: maximum number of server processes which are kept spare
    # MaxClients: maximum number of server processes allowed to start
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_prefork_module>
        StartServers          5
        MinSpareServers       5
        MaxSpareServers      10
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    
    # worker MPM
    # StartServers: initial number of server processes to start
    # MaxClients: maximum number of simultaneous client connections
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_worker_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    
    # event MPM
    # StartServers: initial number of server processes to start
    # MaxClients: maximum number of simultaneous client connections
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_event_module>
        StartServers          2
        MaxClients          150
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxRequestsPerChild   0
    </IfModule>
    
    # These need to be set in /etc/apache2/envvars
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}
    
    #
    # AccessFileName: The name of the file to look for in each directory
    # for additional configuration directives.  See also the AllowOverride
    # directive.
    #
    
    AccessFileName .htaccess
    
    #
    # The following lines prevent .htaccess and .htpasswd files from being
    # viewed by Web clients.
    #
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>
    
    #
    # DefaultType is the default MIME type the server will use for a document
    # if it cannot otherwise determine one, such as from filename extensions.
    # If your server contains mostly text or HTML documents, "text/plain" is
    # a good value.  If most of your content is binary, such as applications
    # or images, you may want to use "application/octet-stream" instead to
    # keep browsers from trying to display binary files as though they are
    # text.
    #
    DefaultType text/plain
    
    #
    # HostnameLookups: Log the names of clients or just their IP addresses
    # e.g., www.apache.org (on) or 204.62.129.132 (off).
    # The default is off because it'd be overall better for the net if people
    # had to knowingly turn this feature on, since enabling it means that
    # each client request will result in AT LEAST one lookup request to the
    # nameserver.
    #
    HostnameLookups Off
    
    # ErrorLog: The location of the error log file.
    # If you do not specify an ErrorLog directive within a <VirtualHost>
    # container, error messages relating to that virtual host will be
    # logged here.  If you *do* define an error logfile for a <VirtualHost>
    # container, that host's errors will be logged there and not here.
    #
    ErrorLog /var/log/apache2/error.log
    
    #
    # LogLevel: Control the number of messages logged to the error_log.
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    #
    
    #
    LogLevel warn
    
    # Include module configuration:
    Include /etc/apache2/mods-enabled/*.load
    Include /etc/apache2/mods-enabled/*.conf
    
    # Include all the user configurations:
    Include /etc/apache2/httpd.conf
    
    # Include ports listing
    Include /etc/apache2/ports.conf
    
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    # If you are behind a reverse proxy, you might want to change %h into %{X-Forwa$
    #
    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" $
    LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combin$
    LogFormat "%h %l %u %t \"%r\" %>s %O" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    
    #
    # Define an access log for VirtualHosts that don't define their own logfile
    CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
    
    # Include of directories ignores editors' and dpkg's backup files,
    # see README.Debian for details.
    
    # Include generic snippets of statements
    Include /etc/apache2/conf.d/
    
    # Include the virtual host configurations:
    Include /etc/apache2/sites-enabled/
    
    cd /etc/apache2/sites-enabled/
    ls shows "000-default".

    sudo nano 000-default produces a blank file.
    What should the contents of this file be?

    Should I just get rid of Webmin? Do I even need it for the level I'm working at? (All I want to do is upload files by FTP and view them at an IP/domain name online-- basic webserver stuff.)
     
    Last edited: 23 Feb 2010
  10. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    I tried putting 72.213.46.84:2280 into the file, but it did nothing.
     
  11. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    If you put in an IP, put in the private one.
     
  12. koola

    koola Minimodder

    Joined:
    11 Jul 2004
    Posts:
    2,462
    Likes Received:
    10
    No, it's rather easy and a free alternative. Of course he could just buy another router and be done :)
     
  13. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,974
    Likes Received:
    856
    sites-enabled/<filename> should just be a symlink to ../sites-available/<filename> - which should have a HTTP virtual host and folder directive inside it.
    Webmin is for full control of your entire server, and I've got to be honest - I've never gotten on well with it.

    It seems to make the whole process of configuring things so much more confusing that just finding a decent sample config and running with it.

    Keep your httpd.conf as it is, and try this:

    1. vi /etc/apache2/sites-available/mysite
    2. Add the following to this file (subsitituing the path in DocumentRoot and Directory as needed)
    Code:
    <VirtualHost *:2280>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/mysite/public_html
    </VirtualHost>
    
    <Directory /var/www/mysite/public_html>
        Options Indexes FollowSymLinks
        DirectoryIndex index.php index.htm index.html
    </Directory>
    
    3. cd /etc/apache2/sites-enabled
    4. ln -s /etc/apache2/sites-enabled/mysite mysite

    If it still exists, delete your 000-default symlink with rm -f 000-default.

    Then restart apache.

    Let us know if this helps.
     

Share This Page