I want to implement the following with nginx:
https://www.example.com/project1 --> /data/www/pro1/public
https://www.example.com/project2 --> /data/www/pro2/public
Here is my nginx configuration:
server {
listen 80;
server_name www.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name www.example.com;
index index.html index.php;
root html;
rewrite_log on;
error_log /data/wwwlogs/itjuzi/xxxerror.log debug;
access_log /data/wwwlogs/itjuzi/saas.itjuzi.com.log access;
location /project1 {
alias /data/www/pro1/public;
try_files $uri $uri/ @pro1;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
location @pro1 {
rewrite /project1/(.*)$ /project1/index.php?/$1 last;
}
This correctly accesses the index.php of the pro1 project.
But the browser address is strange:
https://www.example.com/https:/www.example.com/project1/login
This problem has been bothering me all day.
HELP ME! !! THANKS ^_^