【发布时间】:2019-01-29 13:37:03
【问题描述】:
我正在学习 NGINX,我需要使用 .htaccess 设置一个带有 NGINX 的前端网络服务器和一个带有 Apache 的后端网络服务器
这是/etc/nginx/sites-available/my_test5.loc的内容
server {
charset utf-8;
client_max_body_size 128M;
listen 80;
server_name my_test5.loc;
root /var/www/my_test5.loc/web;
#root /var/www/my_test5.loc;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~* /\. {
# deny all;
allow all;
}
}
这是/etc/apache2/sites-available/my_test5.loc.conf的内容
<VirtualHost *:8080>
<Directory /var/www/my_test5.loc/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerAdmin admin@my_test5.loc
ServerName my_test5.loc
ServerAlias www.my_test5.loc
DocumentRoot /var/www/my_test5.loc/web/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
现在我要做的只是主页。例如,如果我尝试导航到站点/关于我不能。我做错了什么以及如何使用这两个网络服务器?
【问题讨论】:
标签: apache .htaccess nginx proxy