Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • in reply to: not sure why nginx rewrite is not performed #18917
    FunGuy
    Active
    Post count: 11
    This reply has been marked as private.
    in reply to: not sure why nginx rewrite is not performed #18841
    FunGuy
    Active
    Post count: 11
    This reply has been marked as private.
    in reply to: not sure why nginx rewrite is not performed #18791
    FunGuy
    Active
    Post count: 11
    This reply has been marked as private.
    in reply to: not sure why nginx rewrite is not performed #18293
    FunGuy
    Active
    Post count: 11
    This reply has been marked as private.
    in reply to: not sure why nginx rewrite is not performed #18282
    FunGuy
    Active
    Post count: 11

    Hi,

    I changed to this:

    server {
    listen 80;
    server_name everhide.happybits.lt;
    root /srv/www/clients/everhide/current/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/everhide-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_read_timeout 180;
    }

    location ~ /\.ht {
    deny all;
    }

    # BEGIN Hide My WP

    rewrite ^/lib/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?putyo_hide_my_wp=1234 last;
    rewrite ^/login /wordpress/wp-login.php?putyo_hide_my_wp=1234 last;
    rewrite ^/lib/(.*) /wordpress/wp-includes/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/files/(.*) /content/uploads/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/modules/(.*) /content/plugins/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/template/(.*) /content/themes/storefront/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/ajax /wordpress/wp-admin/admin-ajax.php?putyo_hide_my_wp=1234 last;

    # END Hide My WP
    }

    restarted nginx, but it did not take any effect – you can check in here: everhide.happybits.lt

    Maybe any more ideas?

    in reply to: not sure why nginx rewrite is not performed #18261
    FunGuy
    Active
    Post count: 11

    Hi, Suman,

    I deployed to a custom link so that you could see my problems:

    everhide.happybits.lt

    This is how nginx looks like:

    server {
    listen 80;
    server_name everhide.happybits.lt;
    root /srv/www/clients/everhide/current/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {

    # BEGIN Hide My WP

    rewrite ^/lib/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?putyo_hide_my_wp=1234 last;
    rewrite ^/login /wordpress/wp-login.php?putyo_hide_my_wp=1234 last;
    rewrite ^/lib/(.*) /wordpress/wp-includes/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/files/(.*) /content/uploads/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/modules/(.*) /content/plugins/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/template/(.*) /content/themes/storefront/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/ajax /wordpress/wp-admin/admin-ajax.php?putyo_hide_my_wp=1234 last;

    # END Hide My WP

    try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/everhide-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_read_timeout 180;
    }
    location ~ /\.ht {
    deny all;
    }

    }

    This is how wp-config.php is like originally:

    <?php
    /**
    * Set root path.
    */
    $rootPath = realpath(__DIR__ . ‘/..’);

    /**
    * Include the Composer autoloader.
    */
    include $rootPath . ‘/vendor/autoload.php’;

    /**
    * Set site URL.
    */
    $server_url = getenv(‘SITE_URL’);

    /**
    * Define environment.
    */
    define(‘APP_ENV’, getenv(‘APP_ENV’));

    /**
    * Set database details.
    */
    define(‘DB_NAME’, getenv(‘DB_NAME’));
    define(‘DB_USER’, getenv(‘DB_USER’));
    define(‘DB_PASSWORD’, getenv(‘DB_PASSWORD’));
    define(‘DB_HOST’, getenv(‘DB_HOST’));

    /**
    * Set debug mode.
    */
    define(‘WP_DEBUG’, getenv(‘WP_DEBUG’) === ‘true’ ? true : false);

    /**
    * SSL.
    */
    define(‘FORCE_SSL_ADMIN’, getenv(‘WP_FORCE_SSL’) === ‘true’ ? true : false);
    define(‘FORCE_SSL_LOGIN’, getenv(‘WP_FORCE_SSL’) === ‘true’ ? true : false);

    if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] === ‘https’)
    {
    $_SERVER[‘HTTPS’] = ‘on’;
    }

    /**
    * Set custom paths.
    * These are required because WordPress is installed in a subdirectory.
    */
    define(‘WP_CONTENT_URL’, $server_url . ‘/content’);
    define(‘WP_SITEURL’, $server_url . ‘/wordpress’);
    define(‘WP_HOME’, $server_url . ‘/’);
    define(‘WP_CONTENT_DIR’, __DIR__ . ‘/content’);

    define( ‘CONCATENATE_SCRIPTS’, false );
    // define( ‘SCRIPT_DEBUG’, true );

    /**
    * Usual WordPress stuff – don’t overide the ones you have already.
    */
    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    // define(“ADMIN_COOKIE_PATH”, “/wordpress/panel”);

    /**
    * Authentication unique keys and salts.
    *
    * @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
    */
    define(‘AUTH_KEY’, ‘put your unique phrase here’);
    define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
    define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
    define(‘NONCE_KEY’, ‘put your unique phrase here’);
    define(‘AUTH_SALT’, ‘put your unique phrase here’);
    define(‘SECURE_AUTH_SALT’, ‘put your unique phrase here’);
    define(‘LOGGED_IN_SALT’, ‘put your unique phrase here’);
    define(‘NONCE_SALT’, ‘put your unique phrase here’);

    /**
    * WordPress database table prefix.
    * Use something other than wp_ for security.
    */
    $table_prefix = getenv(‘DB_PREFIX’);

    /**
    * Absolute path to the WordPress directory.
    */
    if (!defined(‘ABSPATH’))
    {
    define(‘ABSPATH’, dirname(__FILE__) . ‘/’);
    }

    require_once(ABSPATH . ‘wp-settings.php’);

    /**
    * Start Suzie
    */
    suzie();

    Maybe the problem is that wordpress is in a sub directory?

    As you might see the embed file is failing and apart from includes nothing else is changed by the plugin and nginx (plugins to modules, uploads folder to files and etc.)

    I have amended a bit nginx configuration suggested by the plugin, original suggestion from the plugin is here:

    # BEGIN Hide My WP

    rewrite ^/lib/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?putyo_hide_my_wp=1234 last;
    rewrite ^/login /wordpress/wordpress/wp-login.php?putyo_hide_my_wp=1234 last;
    rewrite ^/lib/(.*) /wordpress/wp-includes/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/files/(.*) /wordpress/http:/everhide.happybits.lt/content/uploads/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/modules/(.*) /wordpress/http:/everhide.happybits.lt/content/plugins/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/template/(.*) /wordpress/http:/everhide.happybits.lt/content/themes/storefront/$1?putyo_hide_my_wp=1234 last;
    rewrite ^/ajax /wordpress/wp-admin/admin-ajax.php?putyo_hide_my_wp=1234 last;

    # END Hide My WP

    Please let me know what I could do to make this work.

    Thanks.

    • This reply was modified 7 years, 11 months ago by FunGuy.
    in reply to: not sure why nginx rewrite is not performed #18197
    FunGuy
    Active
    Post count: 11

    This is what plugin actually suggests:

    rewrite ^/files/(.*) /wordpress/http:/everhide.wordpress.dev/content/uploads/$1?putyo_happybits=administrator last;
    rewrite ^/modules/(.*) /wordpress/http:/everhide.wordpress.dev/content/plugins/$1?putyo_happybits=administrator last;

    But this is straight away looks like something wrong.

    http:/everhide.wordpress.dev/ – is locally on a vagrant machine so not available externally. I still struggle a bit with this as I tried a lot of different variants and still can not make this to work, except for this:

    rewrite ^/includes/(.*) /wordpress/wp-includes/$1?putyo_happybits=administrator last;

    which works just fine.

    in reply to: After changing wp-includes to custom link errors occur #18170
    FunGuy
    Active
    Post count: 11

    Has this file to be somehow dynamically created or nginx should understand that this file has to be switched for the file called embed.min.js?

    in reply to: After changing wp-includes to custom link errors occur #18168
    FunGuy
    Active
    Post count: 11

    Hi, After updating nginx this looks a lot better, but this line:

    rewrite ^/includes/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?putyo_happybits=administrator last;

    still fails, because there is no file embed.min.js

    So, browser returns 404:

    GET http://everhide.wordpress.dev/wordpress/includes/js/embed.min.js 404 (Not Found) as the file is called wp-embed.min.js

Viewing 9 posts - 1 through 9 (of 9 total)