Hi there,
I am still new to Linux/Ubuntu 18.04 lts and have been using Nginx recently.
Has anyone have a solution/ideas what shall I do to enable “Origin” for the smooth exchange of requests and data between php(folder1) + vue(another folder) ? When I try to open links in my vue get CORS policy prohibited action as the localhost differs in localhost:8000 on default and for vue :8080.
My project consists of two folders 1st: php + dbconnection & 2nd vue admin part.
Second question, Is it related to my nginx conf, or is it more Ubuntu authorization part?
I will be looking after to your answers.
here is my virtual host config for nginx :
server {
listen 80;
server_name somelocal;
root /home/some/some/some/VirtualHost3/public;
add_header ‘Access-Control-Allow-Origin’ ‘*’;
add_header ‘Access-Control-Allow-Headers’ ‘origin, x-requested-with, content-type’;
index index.php index.html index.htm;
# add_header Access-Control-Allow-Origin *;
# serve static files directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
# add_header Access-Control-Allow-Origin *;
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
# try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}