小编Rob*_*ant的帖子

如何在Apache上默认启用完美的前向保密?

警告:请仅使用以下答案中的Apache配置建议.对于要使用的密码 - 安全规范会随着时间的推移而改变,下面的一些安全建议已经过时了.

在最近发生的事件之后,我一直在重新考虑我的Apache设置.目前,我的apache站点配置看起来像这样:

 <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName example.com
            ServerAlias www.example.com
            Redirect permanent / https://example.com
    </VirtualHost>

    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
            ServerName example.com

            DocumentRoot /var/www-wordpress
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www-wordpress>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride FileInfo
                    Order allow,deny
                    allow from all
            </Directory>

            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>

            ErrorLog ${APACHE_LOG_DIR}/error.log
            LogLevel warn

            CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
            SSLCertificateFile    /etc/ssl/certs/example.com.crt
            SSLCertificateKeyFile /etc/ssl/private/example.com.key
            SSLCertificateChainFile /etc/ssl/certs/sub.class1.server.ca.pem
            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                    SSLOptions …
Run Code Online (Sandbox Code Playgroud)

apache ssl cryptography

66
推荐指数
2
解决办法
7万
查看次数

我可以在金字塔中拥有多个ini配置文件吗?

我想要一个相当于Django One True Way设置布局:共享基本文件,然后是生产文件和开发文件,每个文件都导入共享库.

Pyramid的配置是否可以实现?

python ini paster pyramid python-paste

7
推荐指数
1
解决办法
918
查看次数

通过递归查找数组中最大的正int

我决定递归地实现一个非常简单的程序,看看Java如何处理递归*,并且有点短.这就是我最后写的:

public class largestInIntArray {
  public static void main(String[] args)
  {
    // These three lines just set up an array of ints:
    int[] ints = new int[100];
    java.util.Random r = new java.util.Random();
    for(int i = 0; i < 100; i++) ints[i] = r.nextInt();

    System.out.print("Normal:"+normal(ints,-1)+" Recursive:"+recursive(ints,-1));
  }

  private static int normal(int[] input, int largest) {
    for(int i : input)
      if(i > largest) largest = i;

    return largest;
  }

  private static int recursive(int[] ints, int largest) {
    if(ints.length == 1)
      return ints[0] …
Run Code Online (Sandbox Code Playgroud)

java puzzle recursion

6
推荐指数
2
解决办法
2万
查看次数

在Spring-MVC Tomcat webapp中嵌入ActiveMQ代理

我有一个小型的Spring MVC webapp(它嵌入了ActiveMQ),它设计用于在本地Tomcat中运行,并可靠地向远程ActiveMQ上的队列发送消息.

除了"可靠"之外,所有这些都已到位.目前,如果远程站点出现故障,则发送失败.我的发送配置:

<!-- Connection setup -->
<bean id="connectionFactory" 
    class="org.apache.activemq.ActiveMQConnectionFactory" 
    p:brokerURL="tcp://backend-server-box:61616" />

<bean id="cachedConnectionFactory" 
    class="org.springframework.jms.connection.CachingConnectionFactory"
    p:targetConnectionFactory-ref="connectionFactory" 
    p:sessionCacheSize="10" />

<!-- Bean that represents the correct destination on the backend server -->
<bean id="backendDestination" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="jmsQueueName" />
</bean>

<bean id="backendTemplate" 
    class="org.springframework.jms.core.JmsTemplate"
    p:connectionFactory-ref="cachedConnectionFactory"
    p:defaultDestination-ref="backendDestination" />

<!-- Bean that sends to the correct destination on the backend server -->
<bean id="simpleSender" class="uk.co.mycompany.client.messaging.SimpleSender">
    <property name="jmsTemplate" ref="backendTemplate" />
</bean>
Run Code Online (Sandbox Code Playgroud)

我认为我需要的是一个本地的,持久的代理,connectionFactory(上面定义的第一个bean)指向,它知道远程代理(JMS到JMS桥?)如果有一些清晰的文档来处理这个问题我很高兴被指出,但我不得不把事情拼凑在一起,主要来自非常有帮助的BruceBlog.或任何直接的帮助都会很棒.

谢谢

更新.一些修复:

  1. Eclipse没有正确找到amq命名空间.是你找出为什么这是破碎的,这是一个容易解决.
  2. 正如Miklos在下面的评论中所说,你需要在webapp lib中使用org.osgi.core-4.1.0.jar.从ActiveMQ lib/optional文件夹中获取此信息.
  3. 您还需要Apache Commons xbean-spring-3.4.jar.得到它 …

spring tomcat activemq-classic jms spring-mvc

6
推荐指数
1
解决办法
2万
查看次数

linux上的强制文件锁

在Linux上我可以dd在硬盘上找到一个文件并在dautilus中删除它,而dd仍在继续.

Linux是否可以强制执行强制文件锁定来保护R/W?

linux protection locking

3
推荐指数
2
解决办法
7817
查看次数

如何将通用视图代码放入 Django 基本模板中

我有一个简单的 Django 网站,其中包含一个基本模板,然后是特定页面的各种模板。这非常适合应用品牌、风格等。

我的网站在概念上类似于 JIRA 之类的网站,其中每个视图都需要通过一个名为“项目”的总体变量来通知,用户可以从菜单栏中的下拉列表中进行选择。

菜单栏位于基本模板中。下拉列表将由数据库查询填充(获取与登录用户关联的所有项目)。我如何执行该查询并将数据发送到基本模板?我不想将相同的查询附加到使用模板的每个视图!

django django-templates django-views

1
推荐指数
1
解决办法
1013
查看次数