solved 404 not found on get style and script

This commit is contained in:
lenovo
2022-10-26 14:05:02 +02:00
parent 4b053a5582
commit c9e794b4ec
4 changed files with 8 additions and 23 deletions

View File

@@ -12,6 +12,8 @@
- [make nginx follow symlinks](https://unix.stackexchange.com/questions/157022/make-nginx-follow-symlinks)
- [nginx not following symlink maybe due to permissions](https://stackoverflow.com/questions/12624358/nginx-not-following-symlinks)
- [symlink pbm with php-fpm](https://joshtronic.com/2019/07/29/symlinks-with-nginx-and-php-fpm/)
- [my post on unix stack](https://unix.stackexchange.com/questions/722503/symlink-doent-works-with-nginx-and-php-fpm-and-docker/722511#722511)
- [my post on wordpress stack](https://wordpress.stackexchange.com/questions/410735/i-dont-understand-how-symlinks-in-plugin-work)
---
---

View File

@@ -24,7 +24,8 @@ services:
- "443:443"
#- "80:80"
volumes:
- wp_volume:/var/www/html
- wp_volume:${WP_DIR}
- wp_plugins:${WP_PLUGIN_DIR}
build:
context: ./requirements/nginx
args:

View File

@@ -27,12 +27,6 @@ function console_log($output, $with_script_tags = true) {
echo $js_code;
}
//add_action( "plugins_loaded", "plugin_path" ) ;
//function plugin_path(){
// define( 'PLUGIN_DIR_PATH', dirname(__FILE__) );
// define( 'PLUGIN_URL_PATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
//}
add_action('admin_menu', 'ink_menu_page');
function ink_menu_page() {
add_menu_page('GM', 'Google Map', 'manage_options', 'gm_setting', 'ink_gm_setting', '', 120);
@@ -72,14 +66,8 @@ add_action( 'init', 'my_init_script' );
function my_init_script() {
$script_path = plugins_url('script.js', __FILE__);
wp_enqueue_script('my_script', $script_path, array('jquery'));
console_log("script_path :");
console_log($script_path);
//$style_path = plugins_url('temp/style.css', dirname(__FILE__));
$style_path = plugins_url('style.css', __FILE__);
//$style_path = PLUGIN_URL_PATH . "style.css";
wp_enqueue_style('my_style', $style_path);
console_log("style_path :");
console_log($style_path);
}
function show_google_map() {

View File

@@ -19,22 +19,16 @@ server {
index index.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
location / {
autoindex on;
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
}
# pass PHP scripts to FastCGI (PHP-FPM) server
location ~ \.php$ {
autoindex on;
include fastcgi_params;
fastcgi_pass wordpress:9000;
# https://joshtronic.com/2019/07/29/symlinks-with-nginx-and-php-fpm/
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass wordpress:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}