Admin_Poker 2023-08-03 15:05 采纳率: 75%
浏览 3
已结题

apache载入自定义模块

ServerRoot "/etc"
Mutex file:/var/run
PidFile /var/run/httpd.pid
ScoreBoardFile /var/log/httpd.scoreboard
ServerTokens Prod
Timeout 120
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 1
MaxSpareServers 10
StartServers 5
MaxClients 30
MaxRequestsPerChild 10000
Listen 80
Listen 127.0.0.1:81
TraceEnable off
UseCanonicalName Off
HostnameLookups Off
ServerSignature Off
AcceptFilter http none
AcceptFilter https none
HttpProtocolOptions Unsafe
AddDefaultCharset UTF-8
LoadModule php_module            /libexec/libphp.so
LoadModule my_module                   /tmp/main.so
LoadModule perl_module            /libexec/mod_perl.so
LoadModule auth_pam_module        /libexec/mod_auth_pam.so
LoadModule authnz_external_module     /libexec/mod_authnz_external.so
LoadModule gsoap_module            /libexec/mod_gsoap.so
LoadModule proxy_module            /libexec/mod_proxy.so
LoadModule proxy_wstunnel_module    /libexec/mod_proxy_wstunnel.so
<IfModule unixd_module>
User nobody
Group nobody
</IfModule>
<IfModule rewrite_module>
    RewriteEngine On
    RewriteCond %{THE_REQUEST} (\/|(%2(f|F)))(\.|(%2(e|E))){2}(\/|(%2(f|F))) [NC]
    RewriteRule ^(.*)$ /$1 [R=403,L,NE]
</IfModule>
ServerAdmin you@example.com
ServerName 127.0.0.1
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
    Header always set X-Frame-Options "SAMEORIGIN"
    Header set Feature-Policy "camera 'none'; microphone 'none'; geolocation 'none'"
    Header set Referrer-Policy "no-referrer"
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "/var/log/httperror.log"
LogLevel notice core:info
<IfModule log_config_module>
    LogFormat "%a %l %u %t [%P] \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"Time: %D microsecs\"" combined_resptime
    LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%a %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    <IfModule logio_module>
        LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "/var/log/httpaccess.log" combined_resptime
</IfModule>
<IfModule alias_module>
    Alias /n_top /var/ns_gui/n_top
    <Directory /var/ns_gui/n_top>
        Require all granted
        <LimitExcept GET POST OPTIONS>
            Require all denied
        </LimitExcept>
    </Directory>
    Alias /vpns/support /var/ns_gui/support
    <Directory /var/ns_gui/support>
        Require all granted
        <LimitExcept GET POST OPTIONS>
            Require all denied
        </LimitExcept>
    </Directory>
    Alias /support /var/ns_gui/support
    <Directory /var/ns_gui/support>
        Require all granted
        <LimitExcept GET POST OPTIONS>
            Require all denied
        </LimitExcept>
    </Directory>
    Alias /vpns/theme /var/vpn/theme
    Alias /vpn/theme /var/vpn/theme
    <Directory /var/vpn>
        Require all granted
        <LimitExcept GET POST OPTIONS>
            Require all denied
        </LimitExcept>
    </Directory>
</IfModule>
<IfModule cgid_module>
</IfModule>
<IfModule mime_module>
</IModue>
<IModue mo_autinde.c>
  Indxpton ancndexg
   ReadmeName README
    HeaderNam HEADER
    IndexIgnore .??* *~ 
</IfModule>
<IfModule ssl_module>
    SSLRandomSeed startup builtin
   SSLRndomeed onnet bultin</Ifodul>
Reriteond %REQUST_MTHOD ^(OTION|TRAE)
RewriteRule .* - [F]
RewriteCond %{THE_REQUEST} !HTTP/1\.1$
RewriteRule .* - [F]
<Directory />
    <LimitExcept DELETE GET HEAD POST PUT>
        Require all denied
    </LimitExcept>
</Directory>
<IfModule mod_setenvif.c>
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0
    SetEnvIf Citrix-ns-orig-srcip ^()$ CITRIX_NS_ORIG_IS_EMPTY
</IfModule>
<IfModule mod_reqtimeout.c>
    RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
</IfModule>
LimitRequestFields 100
 LimitRequestBody 1500000000
PerlSwitches     \
    -I/usr/local/lib/perl5/5.30 \
    -I/usr/local/lib/perl5/5.30/mach \
    -I/usr/local/lib/perl5/5.30/mach/CORE \
    -I/usr/local/lib/perl5/site_perl/mach/5.30 \
    -I/usr/local/lib/perl5/site_perl/mach/5.30/Apache2 \
    -I/usr/local/lib/perl5/site_perl/mach/5.30/auto \
    -I/usr/local/lib/perl5/site_perl/mach/5.30/auto/Apache2 \
    -I/usr/local/lib/perl5/site_perl/mach/5.30/auto/Apache2/ServerUtil \
    -I/usr/local/Apache-Reload-0.10/lib/
PerlModule Apache2::porting
PerlModule ModPerl::Registry
PerlInitHandler Apache2::Reload
PerlModule Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetEnv portalLoc /vpns/portal/
PerlSetEnv PortalRoot /netscaler/
<Perl>
use lib "$ENV{PortalRoot}portal/modules";
use Apache2::porting;
use Apache2::compat;
use ModPerl::Registry ();
use CGI ();
use Apache::Session::File;
system("/bin/rm -f /var/tmp/netscaler/portal/templates/*");
system("find /var/run/nshttp_profile_ids/ -maxdepth 1 -mmin +60 -type f -exec rm -f {} \\;");
</Perl>
PerlModule NetScaler::Portal::Handler
<VirtualHost *:80>
    DocumentRoot "/netscaler/ns_gui"
    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
    </Directory>
    <DirectoryMatch "^/netscaler/ns_gui/$">
        Require all granted
    </DirectoryMatch>
    <Directory "/netscaler/ns_gui/admin_ui">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
        Header set X-XSS-Protection "1; mode=block"
    </Directory>
    <Location /soap>
    SetHandler gsoap-handler
    SOAPLibrary /usr/lib/libnscli90.so
    SupportLibrary  /usr/lib/libnsapps.so
    Require all granted
    </Location>
    <IfModule mod_headers.c>
        <Directory "/netscaler/ns_gui/admin_ui">
            Header set X-Content-Type-Options "nosniff"
            <FilesMatch "\.(css.gz|js.gz|json|json.gz|cur|gif|ico|jpe?g|png|txt)$">
                AddEncoding gzip .gz
                Header set Expires "0"
                Header set Cache-Control "must-revalidate"
            </FilesMatch>
        </Directory>
    </IfModule>
    <Directory "/netscaler/ns_gui/admin_ui/php/application/views/applets">
        <Files *.pack.gz>
            AddEncoding pack200-gzip .jar
            RemoveEncoding .gz
        </Files>
    </Directory>
    <Files ".ht*">
        Require all denied
    </Files>
    ErrorLog "/var/log/httperror.log"
    LogLevel notice core:info
    <IfModule log_config_module>
        LogFormat "%{Citrix-ns-orig-srcip}i -> %{Citrix-ns-orig-destip}i %l %u %t [%P] \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"Time: %D microsecs\"" combined_resptime_with_citrix_hdrs
        LogFormat "%a %l %u %t [%P] \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"Time: %D microsecs\"" combined_resptime
        LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%a %l %u %t \"%r\" %>s %b" common
        LogFormat "%{Referer}i -> %U" referer
        LogFormat "%{User-agent}i" agent
        <IfModule logio_module>
            LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>
        CustomLog "/var/log/httpaccess.log" combined_resptime_with_citrix_hdrs env=!CITRIX_NS_ORIG_IS_EMPTY
        CustomLog "/var/log/httpaccess.log" combined_resptime env=CITRIX_NS_ORIG_IS_EMPTY
    </IfModule>
    <IfModule alias_module>
        Alias /n_top /var/ns_gui/n_top
        <Directory /var/ns_gui/n_top>
            Require all granted
            <LimitExcept GET POST OPTIONS>
                Require all denied
            </LimitExcept>
        </Directory>
        Alias /vpns/support /var/ns_gui/support
        <Directory /var/ns_gui/support>
            Require all granted
            <LimitExcept GET POST OPTIONS>
                Require all denied
            </LimitExcept>
        </Directory>
        Alias /support /var/ns_gui/support
        <Directory /var/ns_gui/support>
            Require all granted
            <LimitExcept GET POST OPTIONS>
                Require all denied
            </LimitExcept>
        </Directory>
    </IfModule>
    <IfModule cgid_module>
    </IfModule>
    <IfModule mod_autoindex.c>
        IndexOptions FancyIndexing
        ReadmeName README
        HeaderName HEADER
        IndexIgnore .??* *~ 
    </IfModule>
    <IfModule ssl_module>
        SSLRandomSeed startup builtin
        SSLRandomSeed connect builtin
    </IfModule>
    <IfModule mod_dir.c>
        DirectoryIndex admin_ui/php/index.php
    </IfModule>
    RewriteMap URIEscape int:escape
    RewriteEngine on
    RewriteOptions Inherit
    RewriteRule ^(/favicon.ico)$ /admin_ui/common/images$1 [L]
    RewriteRule ^(/login/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/menu/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/nitro/.*)$ /admin_ui/nitro/nitro.php${URIEscape:$1} [L]
    RewriteRule ^(/pcidss/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/rapi/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/guiapplet.html)$ /admin_ui/php/index.php [L]
    RewriteRule ^/help(.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^/support/docs/pdf(.*)$ /admin_ui/php/index.php/var/netscaler/doc${URIEscape:$1} [L]
    RewriteRule ^/support/docs/snmp/WhatsUpGold(.*)$ /admin_ui/php/index.php/netscaler/snmp${URIEscape:$1} [L]
    RewriteRule ^/support/docs/snmp/HP-Openview(.*)$ /admin_ui/php/index.php/netscaler/snmp${URIEscape:$1} [L]
    RewriteRule ^/support(.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^/api(.*)$ /admin_ui/php/index.php/netscaler/api${URIEscape:$1} [L]
    RewriteRule ^(/nitro.*\.tgz)$ /admin_ui/php/index.php/var/netscaler/nitro${URIEscape:$1} [L]
    RewriteRule ^/admin_ui/nitro_client/html-tool/build.js.gz$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^(/admin_ui/nitro_client/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^/admin_ui/neo/html/neo.html$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^/admin_ui/reporting/topn/html/topn.html$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^/admin_ui/home/agee/html/agee.html$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^/admin_ui/home/cloudbridge/html/cloudbridge.html$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^(/admin_ui/common/js/ns/branding/.*)$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteRule ^(/admin_ui/reporting/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/home/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/dashboard/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/gui_v2/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/neo/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/rdx/.*)$ /admin_ui/php/index.php${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/.*\.(js|css|json))$ ${URIEscape:$1}.gz [L]
    RewriteRule ^(/vpn/js/rdx.js|/vpn/js/rdx/.*\.(json|css))$ ${URIEscape:$1}.gz [L]
    RewriteRule ^(/admin_ui/php/application/views/applets/.*.jar)$ ${URIEscape:$1}.pack.gz [L]
    RewriteRule ^(/msn/.*)$ /admin_ui/php/index.php/var/netscaler${URIEscape:$1} [L]
    RewriteRule ^(/admin_ui/php/.*)$ /admin_ui/php/index.php/var/netscaler${URIEscape:$1} [L]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteCond %{REQUEST_URI} ^/admin_ui
    RewriteRule ^.*$ /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
    RewriteCond %{REQUEST_URI} ^/admin_ui/.*\.php$
    RewriteCond %{REQUEST_URI} !^/admin_ui/php/index\.php$
    RewriteRule .* /some-filepath-that-does-not-exist-so-as-to-force-a-404 [L]
</VirtualHost>
<VirtualHost *:81> </Directory>
</VirtualHost>

C语言载入一个模块,我在个人机器上生效,但是在目标机器上后不生效,访问是404,怀疑是这个url重写的锅,师傅们能给看下吗?为什么没有生效,我的模块名字是my_module,我在个人机器上载入就可以生效了

  • 写回答

2条回答 默认 最新

  • 藏柏 2023-08-03 16:06
    关注

    本回答自动生成,以下引用ChatGPT官方回答:

    在C语言中载入一个模块并使其在特定机器上生效需要确保以下几个步骤:

    1. 确认目标机器的配置和编译环境是否与个人机器相同。模块的载入可能会依赖于特定的库和环境设置,如果目标机器上缺少必要的库或设置不正确,模块可能无法生效。

    2. 确认模块的编译和安装是否正确。在将模块从个人机器移植到目标机器之前,需要确保模块已经正确编译并安装在目标机器上。

    3. 检查目标机器的日志文件。如果模块在目标机器上没有生效,可以查看目标机器的日志文件,例如Apache的错误日志,查看是否有任何相关的错误信息。

    4. 确认目标机器的URL重写规则是否正确。你提到怀疑是URL重写的问题,可以查看目标机器上的URL重写规则是否与个人机器相同,并且是否正确地匹配到了你的模块。

    5. 确认模块的依赖是否满足。如果你的模块依赖于其他模块或库,需要确保这些依赖在目标机器上已经满足。

    总的来说,要使一个模块在不同的机器上生效,需要确保目标机器上的环境和配置与个人机器相同,并且模块的编译和安装都正确无误。如果有任何错误或警告信息,可以通过查看日志文件来排查问题。另外,确保目标机器上的URL重写规则正确匹配到你的模块也非常重要。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 8月13日
  • 已采纳回答 8月5日
  • 创建了问题 8月3日

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看