我正在设置wordpress,并且希望同时具有HTTPS和HTTP。
这是用于运行MariaDB,httpd和PHP 7.3.4的OpenBSD服务器。
这是我的httpd.conf
server "www.mycoolsite.com" {
listen on * port 80
listen on * tls port 443
root "/wordpress"
directory index index.php
tls{
certificate "/etc/letsencrypt/live/www.mycoolsite.com/fullchain.pem"
key "/etc/letsencrypt/live/www.mycoolsite.com/privkey.pem"
}
location "*.php" {
fastcgi socket "/run/php-fpm.sock"
}
directory{
index "index.php"
}
}
types {
include "/usr/share/misc/mime.types"
}
证书有效且有效。 通过HTTP,该站点执行PHP,而wordpress正常运行。但是,当我以https://www.mycoolsite.com的身份访问网站时,会获得文本格式的PHP文件。
编辑:文本格式不是原始
答案 0 :(得分:0)
尝试此配置,然后将您的wordpress应用程序目录放在/ pub下。
server "www.mycoolsite.com" {
listen on * port 80
root "/pub"
# Set max upload size to 513M (in bytes)
connection max request body 537919488
# Set max timeout to 600 seconds
connection request timeout 600
location "*.php*" {
fastcgi socket "/run/php-fpm.sock"
}
location "/db_structure.xml" { block }
location "/.ht*" { block }
location "/README" { block }
location "/data*" { block }
location "/config*" { block }
}
server "www.mycoolsite.com" {
listen on * tls port 443
root "/pub"
# Set max upload size to 513M (in bytes)
connection max request body 537919488
# Set max timeout to 600 seconds
connection request timeout 600
tls {
certificate "/etc/ssl//etc/letsencrypt/live/www.mycoolsite.com/fullchain.pem"
key "/etc/letsencrypt/live/www.mycoolsite.com/privkey.pem"
}
location "/pub/*" {
directory index index.php
}
# First deny access to the specified files
location "/db_structure.xml" { block }
location "/.ht*" { block }
location "/README" { block }
location "/data*" { block }
location "/config*" { block }
location "*.php*" {
fastcgi socket "/run/php-fpm.sock"
}
}