[Resolved] scripting httpd_config.xml

Status
Not open for further replies.

djsodom

Active Member
#1
Hi,

I'm trying to create a script that sets up a new litespeed configuration and copies my httpd_config.xml and myapp.xml files locally to the server.

I started by copying these two files from an existing, working installation.

However, I'm getting this error when I try start lsws:
Code:
2007-03-06 14:40:35.967 [ERROR] [config] /opt/lsws/conf/httpd_config.xml: root tag expected: <httpServerConfig>, real root tag : <virtualHostConfig>!
2007-03-06 14:40:35.967 [ERROR] [config] /opt/lsws/conf/httpd_config.xml: root tag expected: <httpServerConfig>, real root tag : <virtualHostConfig>!
Can't determine the Home of LiteSpeed Web Server, exit!
[ERROR] Failed to start lshttpd!
-bash-3.1#
---
Here is what the http_config.xml file looks like:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<httpServerConfig>
  <serverName>lshttpd</serverName>
  <user>lsws</user>
  <group>www</group>
  <priority>0</priority>
  <chrootPath>/</chrootPath>
  <enableChroot>0</enableChroot>
  <inMemBufSize>60M</inMemBufSize>
  <swappingDir>/tmp/lshttpd/swap</swappingDir>
  <autoRestart>1</autoRestart>
  <autoFix503>1</autoFix503>
  <loadApacheConf>0</loadApacheConf>
  <mime>$SERVER_ROOT/conf/mime.properties</mime>
  <showVersionNumber>0</showVersionNumber>
  <autoUpdateInterval>86400</autoUpdateInterval>
  <autoUpdateDownloadPkg>1</autoUpdateDownloadPkg>
  <adminEmails></adminEmails>
    <log>
      <fileName>$SERVER_ROOT/logs/error.log</fileName>
      <logLevel>DEBUG</logLevel>
      <debugLevel>0</debugLevel>
      <rollingSize>10M</rollingSize>
      <enableStderrLog>1</enableStderrLog>
    </log>
    <accessLog
      <fileName>$SERVER_ROOT/logs/access.log</fileName>
      <rollingSize>10M</rollingSize>
      <keepDays>30</keepDays>
      <compressArchive>0</compressArchive>
    </accessLog>
  </logging>
  <indexFiles>index.html</indexFiles>
  <htAccess>
    <allowOverride>0</allowOverride>
    <accessFileName>.htaccess</accessFileName>
  </htAccess>
  <expires>
    <enableExpires>1</enableExpires>
  </expires>
  <tuning>
    <maxConnections>500</maxConnections>
    <maxSSLConnections>200</maxSSLConnections>
    <connTimeout>300</connTimeout>
    <maxKeepAliveReq>1000</maxKeepAliveReq>
    <smartKeepAlive>1</smartKeepAlive>
    <keepAliveTimeout>5</keepAliveTimeout>
    <sndBufSize>65535</sndBufSize>
    <rcvBufSize>65535</rcvBufSize>
    <eventDispatcher>epoll</eventDispatcher>
    <maxCachedFileSize>4096</maxCachedFileSize>
    <totalInMemCacheSize>20M</totalInMemCacheSize>
    <maxMMapFileSize>256K</maxMMapFileSize>
    <totalMMapCacheSize>40M</totalMMapCacheSize>
    <useSendfile></useSendfile>
    <SSLCryptoDevice>null</SSLCryptoDevice>
    <maxReqURLLen>4096</maxReqURLLen>
    <maxReqHeaderSize>8192</maxReqHeaderSize>
    <maxReqBodySize>10M</maxReqBodySize>
    <maxDynRespHeaderSize>4K</maxDynRespHeaderSize>
    <maxDynRespSize>1M</maxDynRespSize>
    <enableGzipCompress>1</enableGzipCompress>
    <enableDynGzipCompress>1</enableDynGzipCompress>
    <gzipCompressLevel>6</gzipCompressLevel>
    <compressibleTypes>text/html</compressibleTypes>
    <gzipAutoUpdateStatic>1</gzipAutoUpdateStatic>
    <gzipStaticCompressLevel>6</gzipStaticCompressLevel>
    <gzipMaxFileSize>1M</gzipMaxFileSize>
    <gzipMinFileSize>300</gzipMinFileSize>
  </tuning>
  <security>
    <fileAccessControl>
      <followSymbolLink>1</followSymbolLink>
      <checkSymbolLink>0</checkSymbolLink>
      <requiredPermissionMask>000</requiredPermissionMask>
      <restrictedPermissionMask>000</restrictedPermissionMask>
    </fileAccessControl>
    <perClientConnLimit>
      <staticReqPerSec>0</staticReqPerSec>
      <dynReqPerSec>0</dynReqPerSec>
      <outBandwidth>0</outBandwidth>
      <inBandwidth>0</inBandwidth>
      <softLimit>10000</softLimit>
      <hardLimit>10000</hardLimit>
      <gracePeriod>15</gracePeriod>
      <banPeriod>300</banPeriod>
    </perClientConnLimit>
    <CGIRLimit>
      <maxCGIInstances>20</maxCGIInstances>
      <minUID>11</minUID>
      <minGID>10</minGID>
      <priority>0</priority>
      <CPUSoftLimit>10</CPUSoftLimit>
      <CPUHardLimit>50</CPUHardLimit>
      <memSoftLimit>200M</memSoftLimit>
      <memHardLimit>300M</memHardLimit>
      <procSoftLimit>400</procSoftLimit>
      <procHardLimit>450</procHardLimit>
    </CGIRLimit>
    <accessDenyDir>
      <dir>/</dir>
      <dir>/etc/*</dir>
      <dir>/dev/*</dir>
      <dir>$SERVER_ROOT/conf/*</dir>
      <dir>$SERVER_ROOT/admin/conf/*</dir>
    </accessDenyDir>
    <accessControl>
      <allow>ALL</allow>
      <deny></deny>
    </accessControl>
  </security>
  <railsDefaults>
    <rubyBin>/usr/bin/ruby</rubyBin>
    <railsEnv>1</railsEnv>
    <maxConns>5</maxConns>
    <env>LSAPI_MAX_REQS=1000</env>
    <env>LSAPI_MAX_IDLE=60</env>
    <initTimeout>60</initTimeout>
    <retryTimeout>0</retryTimeout>
    <pcKeepAliveTimeout>60</pcKeepAliveTimeout>
    <respBuffer>0</respBuffer>
    <backlog>50</backlog>
    <runOnStartUp>0</runOnStartUp>
    <extMaxIdleTime></extMaxIdleTime>
    <priority>3</priority>
    <memSoftLimit>0</memSoftLimit>
    <memHardLimit>0</memHardLimit>
    <procSoftLimit>0</procSoftLimit>
    <procHardLimit>0</procHardLimit>
  </railsDefaults>
  <virtualHostList>
    <virtualHost>
      <name>quizical</name>
      <vhRoot>/home/steveodom/quizical/current</vhRoot>
      <configFile>$SERVER_ROOT/conf/$VH_NAME.xml</configFile>
      <allowSymbolLink>1</allowSymbolLink>
      <enableScript>1</enableScript>
      <restrained>1</restrained>
      <setUIDMode>2</setUIDMode>
      <chrootMode>0</chrootMode>
    </virtualHost>
  </virtualHostList>
  <listenerList>
    <listener>
      <name>80</name>
      <address>*:80</address>
      <binding></binding>
      <secure>0</secure>
      <vhostMapList>
        <vhostMap>
          <vhost>quizical</vhost>
          <domain>*</domain>
        </vhostMap>
      </vhostMapList>
    </listener>
  </listenerList>
  <vhTemplateList>
    <vhTemplate>
      <name>centralConfigLog</name>
      <templateFile>$SERVER_ROOT/conf/templates/ccl.xml</templateFile>
      <listeners>80</listeners>
    </vhTemplate>
    <vhTemplate>
      <name>PHP_SuEXEC</name>
      <templateFile>$SERVER_ROOT/conf/templates/phpsuexec.xml</templateFile>
      <listeners>80</listeners>
    </vhTemplate>
    <vhTemplate>
      <name>EasyRailsWithSuEXEC</name>
      <templateFile>$SERVER_ROOT/conf/templates/rails.xml</templateFile>
      <listeners>80</listeners>
    </vhTemplate>
  </vhTemplateList>
</httpServerConfig>
-----------
Here is myapp file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<virtualHostConfig>
  <docRoot>$VH_ROOT/public/</docRoot>
  <enableGzip>1</enableGzip>
  <logging>
    <log>
      <useServer>1</useServer>
    </log>
    <accessLog>
      <useServer>0</useServer>
      <fileName>$SERVER_ROOT/logs/$VH_NAME.access.log</fileName>
      <logHeaders>3</logHeaders>
      <rollingSize>500M</rollingSize>
      <keepDays>30</keepDays>
      <compressArchive>0</compressArchive>
    </accessLog>
  </logging>
  <index>
    <useServer>0</useServer>
    <indexFiles>index.html</indexFiles>
    <autoIndex>0</autoIndex>
    <autoIndexURI>/_autoindex/default.php</autoIndexURI>
  </index>
  <htAccess>
    <allowOverride>0</allowOverride>
    <accessFileName>.htaccess</accessFileName>
  </htAccess>
  <expires>
    <enableExpires>1</enableExpires>
  </expires>
  <security>
    <hotlinkCtrl>
      <enableHotlinkCtrl>0</enableHotlinkCtrl>
      <suffixes>gif, jpeg, jpg</suffixes>
      <allowDirectAccess>1</allowDirectAccess>
      <onlySelf>1</onlySelf>
    </hotlinkCtrl>
    <accessControl>
      <allow>*</allow>
    </accessControl>
  </security>
  <contextList>
    <context>
      <type>rails</type>
      <uri>/</uri>
      <location>$VH_ROOT/</location>
      <railsEnv>1</railsEnv>
      <maxConns>5</maxConns>
      <enableExpires></enableExpires>
      <expiresDefault></expiresDefault>
      <expiresByType></expiresByType>
      <extraHeaders></extraHeaders>
      <indexFiles></indexFiles>
      <autoIndex></autoIndex>
      <allowOverride></allowOverride>
      <realm></realm>
      <authName></authName>
      <required></required>
      <accessControl>
        <allow></allow>
        <deny></deny>
      </accessControl>
      <authorizer></authorizer>
      <addDefaultCharset>off</addDefaultCharset>
      <defaultCharsetCustomized></defaultCharsetCustomized>
    </context>
  </contextList>
  <rewrite>
    <enable>0</enable>
    <logLevel>0</logLevel>
  </rewrite>
  <frontPage>
    <enable>0</enable>
    <disableAdmin>0</disableAdmin>
  </frontPage>
  <awstats>
    <updateMode>0</updateMode>
    <workingDir>$VH_ROOT/awstats</workingDir>
    <awstatsURI>/awstats/</awstatsURI>
    <siteDomain>localhost</siteDomain>
    <siteAliases>127.0.0.1 localhost</siteAliases>
    <updateInterval>86400</updateInterval>
    <updateOffset>0</updateOffset>
    <securedConn>0</securedConn>
  </awstats>
</virtualHostConfig>
My permissions seem to be correct:
Code:
drwx------ 2 lsws www 4096 Mar  5 20:17 cert
-rw------- 1 lsws www 2405 Mar  6 13:48 httpd_config.xml
-rw------- 1 lsws www 3313 Mar  5 20:17 mime.properties
-rw------- 1 lsws www 5744 Mar  6 13:48 quizical.xml
drwx------ 2 lsws www 4096 Mar  5 20:17 templates
Any ideas?

Steve
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#2
Please double check your httpd_config.xml, you may overwritten it with your app config file.
 
Last edited by a moderator:

djsodom

Active Member
#3
You are absolutely right, Mistwang.

Here is the rake script I was using:
Code:
task :configure_litespeed do
   put File.read("#{BASE}/config/httpd_config.xml"), /home/steveodom/quizical.xml'
 
   put File.read("#{BASE}/config/quizical.xml"), '/home/steveodom/httpd_config.xml'
  start_lsws
end
Notice, how I have the names reversed!

Thanks,

Steve
 
Last edited by a moderator:
Status
Not open for further replies.
Top